换行符
python3中换行符有'\n'
print('hello,world')
正常的输出格式是
hello,world
换行输出
print('hello,\nworld')
显示结果
hello,
world
结束换行
end=''
如 for i in range(5):
print(i)
正常打印结果:
0
1
2
3
4
结束换行:print(i,end=" ")
输出结果:01234
制表符"\t":上述的例子按这个格式输出:print(i,end='\t')
结果:`
0
1
2
3
4
另一种输出方式print(f'\t{i}')
结果:
0
1
2
3
4
行符也可以用这种格式表示print(f'\n{i}')
嘻嘻,是不是好看多了??