为什么python在同一个程序下,对一个文档输入后close,接着输出的是空呢。当把shell关了文档里面才有文字
fopen=file('poem.txt','w')fopen.write(poem)fopen.closefope=file('poem.txt')whileTrue:...
fopen=file('poem.txt','w')
fopen.write(poem)
fopen.close
fope=file('poem.txt')
while True:
line=fope.readline()
if len(line)==0:
break
print line
fope.close 展开
fopen.write(poem)
fopen.close
fope=file('poem.txt')
while True:
line=fope.readline()
if len(line)==0:
break
print line
fope.close 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询