发布网友
共4个回答
热心网友
print是将之后的内容输出到终端显示;
print >>是将内容输出定向到某文件;
例如:
fpa=open("test.txt","w")就是将testStr字符串写到text.txt文件中。
热心网友
print >> sys.stdout的形式就是print的一种默认输出格式,等于print "%VALUE%"
热心网友
不知道,文化有限,建议英汉互译吧。
热心网友
输出定向到某文件追问具体怎么做?假如我要把列表a定向输出到文件file中,应该怎么写呢?
追答f=open('file','w')
a=["Hello",32,('heresy_me',19)]
print >> f, a
f.close()