<分区> 分区>
我正在学习 python 文件处理。我试过这段代码一次读取一个字符
f = open('test.dat', 'r')
while (ch=f.read(1)):
print ch
为什么不工作
这是错误信息
C:\Python27\python.exe "C:/Users/X/PycharmProjects/Learning Python/01.py"
File "C:/Users/X/PycharmProjects/Learning Python/01.py", line 4
while (ch=f.read(1)):
^
SyntaxError: invalid syntax
Process finished with exit code 1
