print函数

输出数字、字符串、表达式(操作数和运算符)

>>> print(1)
1
>>> print('hello,world')
hello,world
>>> print(1+2)
3

输出到文件

>>> fp=open('E:/test.txt','a+')
>>> print('hello,world',file=fp)
>>> fp.close()

同时输出多个(单行输出)

>>> print(1,'nb')
1 nb

 

posted @ 2022-08-09 21:06  盗哥泡茶去了  阅读(58)  评论(0编辑  收藏  举报