打印字符串是python中最基础的语法,可以将结果显示到我们视线中,用print('')实在引号中间输入什么都可以实现,print('','')加上逗号可以实现多个字符串拼接。
字符串打印
1基础用法
chr() 用一个范围在 range(256)内的(就是0~255)整数作参数,返回一个对应的字符。比如chr(48)表示0,下面有实例.
#方法一:利用特殊字符编码输出特殊符号
print(' ',chr(9477)*27,' ')
print(chr(9479),' '*4,'就在这个地方打字',' '*4,chr(9479))
print(' ',chr(9477)*27,' ')
#方法二:使用搜狗输入法工具箱中的符号大全输出特殊符号(制表符)
print(" ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅")
print("┇ 就在这个地方打字 ┇")
print(" ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅")
手动多打印几行
print("★+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++★")
print("★ ★")
print("★ 靓仔 ★")
print("★ ★")
print("★+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++★")
也可以使用换行符\n
print("★+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++★\n★ ★\n★ 靓仔 ★\n★ ★\n★+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++★")
print(chr(9824),chr(9827),chr(9829),chr(9830))
。
print([chr(i) for i in range(945,971)])
\t横着空
print("1000\t"*200)
print(" 1000\n"*100)