发布时间:2019-09-10 09:18:10编辑:auto阅读(2918)
一、环境以及背景
winows10 + python2.7 + python3.5
需要使用python2.7 中的print并且不换行
二、使用方法
1. 在结尾添加一个逗号
print "hello world",
2. 使用sys模块
import sys
sys.stdout.write("hello world")
sys.stdout.flush()
3. 使用python 3.x版本的print
3.x版本 中的print函数增加了一个end参数, 默认值为end='\n'
print ("hello world", end='')
上一篇: Faker:Python的伪造数据生成器
下一篇: python面向对象之类成员
51290
50741
41338
38150
32619
29518
28368
23239
23207
21530
1604°
2338°
1939°
1878°
2206°
1924°
2607°
4378°
4227°
2998°