发布时间:2019-09-20 07:25:50编辑:auto阅读(2092)
python中print之后是默认换行的,
如果我们不想换行,且不想讲输出内容用一个print函数输出时,就需要改变print默认换行的属性,
方法如下:
print('contents', end='')
end就表示print将如何结束,默认为end="\n"(换行)
举例:
让print输出不换行:
如果是python2.7那么print输出不换行写法是加个“逗号”
for line in sys.stdin: print line,
上一篇: windows python MySQL
下一篇: python2.6 升级到 python
50990
50373
40988
37855
32321
29211
28094
22923
22891
21220
1086°
1775°
1448°
1383°
1658°
1469°
2126°
3682°
3621°
2541°