Dav*_*vid 17 python syntax python-2.x
我想知道print >> dbfile, keypython 中的意思是什么.该>>怎么办?
print >> dbfile, key
>>
Gre*_*ill 15
应该注意,>>语法特定于Python 2.x. 在Python 3.x中,该语法消失了,代码需要按如下方式进行更改:
print >>f, "Hello world" # Python 2.x print("Hello world", file=f) # Python 3.x
Jam*_*mes 8
这会重定向print到文件(在本例中dbfile).
print
dbfile
这>>只是一个特殊的语法.
归档时间:
15 年,6 月 前
查看次数:
3382 次
最近记录:
11 年,1 月 前