如果我在 python shell 上键入它,它确实有效
>>> f= open(os.path.join(os.getcwd(), 'test1.txt'), 'r')
>>> f.read()
'plpw eeeeplpw eeeeplpw eeee'
>>> f.close()
但是如果我创建一个python程序,我就不行了。
import os
f= open(os.path.join(os.getcwd(), 'test1.txt'), 'r')
f.read()
f.close()
我使用文本编辑器保存了这段代码。如果我在 python shell 中执行这个程序,它什么也不显示。请告诉我为什么..