在没有空格或换行符的python中打印变量

san*_*055 7 python printing formatting python-2.x python-2.5

打印没有换行符或空格的变量python3通过print(x,end ='')如何在python 2.5中执行它

unp*_*680 11

sys.stdout.write 除非指定,否则写入(仅)没有换行符的字符串.

>>> x = 4
>>> print x
4
>>> import sys
>>> sys.stdout.write(str(x)) # you have to str() your variables
4>>> # <- no newline
Run Code Online (Sandbox Code Playgroud)