怎样使 Python 输出时不换行

python3.x版本使用print('输出内容', end='')这种方式。

示例:
s='abc'
print(s[0])
print(s[:1],end='')//输出ab,未输出换行
print(s[2])//输出c

输出结果:
a
abc

猜你喜欢

转载自www.cnblogs.com/rtyxxy/p/12660187.html