eye*_*mew 2 python printing tabs
说我想要像这样打印:
print 1,"hello", 2, "fart"
Run Code Online (Sandbox Code Playgroud)
但是使用制表符而不是空格,在python 2中,这样做的最pythonic方法是什么?
这是一个非常愚蠢的问题,但我似乎无法找到答案!
另一种方法是展望未来!
# Available since Python 2.6
from __future__ import print_function
# Now you can use Python 3's print
print(1, 'hello', 2, 'fart', sep='\t')
Run Code Online (Sandbox Code Playgroud)