[英]how to take file like object in a file in python
filename = fileobject.read()
我想在文件中传输/分配对象的全部数据。
You are almost doing it correctly already; 您几乎已经正确地执行了; the code should read
该代码应阅读
filecontent = fileobject.read()
read() with no arguments will read the whole data, ie the whole file content. 没有参数的read()将读取整个数据,即整个文件的内容。 The file name has nothing to do with that.
文件名与此无关。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.