python输出不换行

python输出不换行

Python2的写法是

print 'hello',

Python3的写法是

print('hello', end='')

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

from __future__ import print_function

print('hello', end='')
posted @ 2017-05-24 20:41  kris_zhang  阅读(40947)  评论(0编辑  收藏  举报