python输出不换行

来源:互联网 发布:淘宝 店铺 推广 编辑:程序博客网 时间:2024/05/21 17:08

python输出不换行

Python2的写法是

print 'hello',

Python3的写法是

print('hello', end='')

对于python2和python3都兼容的写法是:

from __future__ import print_functionprint('hello', end='')
原创粉丝点击