Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 屏幕上没有输出。当我';我正在读它的文件';他没有输出_Python_Python 3.x - Fatal编程技术网

Python 屏幕上没有输出。当我';我正在读它的文件';他没有输出

Python 屏幕上没有输出。当我';我正在读它的文件';他没有输出,python,python-3.x,Python,Python 3.x,我目前正在学习python文件操作。上述代码工作不正常。它没有读取文件。只需从string=name中删除0。读取(0)以显示全部或写入大于0的数字。 这是应该显示的字符长度。您认为name.read(0)reads有多少数据?你认为零的参数指定了什么?我知道了。。。它应该是name.read()或name.read(-1)。从头开始阅读所有文档。非常感谢。 import time name = open('list.txt','a+') print ("When file was open

我目前正在学习python文件操作。上述代码工作不正常。它没有读取文件。

只需从
string=name中删除
0
。读取(0)
以显示全部或写入大于
0
的数字。
这是应该显示的字符长度。

您认为
name.read(0)
reads有多少数据?你认为零的参数指定了什么?我知道了。。。它应该是name.read()或name.read(-1)。从头开始阅读所有文档。非常感谢。
import time


name = open('list.txt','a+')
print ("When file was opened the pointer was at", name.tell())
name.write('It\'s all about mindset.')
time.sleep(2)
print ("Writing your script.... Wait for some time...")
name.close()
name = open('list.txt','r')
string = name.read(0)
print('Final output is:'`
print (string)
name.close()