Python__01--print()
发布时间:2022-12-16 13:35:05 242
相关标签: # python# 数据
1 打印输出print()
print() 函数用于打印输出,是python中最常见的一个内置函数。
1.1 使用方式
-
可以输出数字
print(520)
-
可以输出字符串
print('helloworld')
-
含有运算符的表达式
print(4+1)
-
将数据输出到文件盘符存在
file=fp=open('D:/text.txt','a+') print('helloworld',file=fp) fp.close()
-
不进行换行输出
print('helloooo','world')
1.2 测试
1.2.1 测试代码
print(520)
print(4+1)
fp=open('text.txt','a+')
print('helloworld',file=fp)
fp.close()
print('hellooooooooo','world')
1.2.2 测试结果
运行结果1:
运行结果2:
文章来源: https://blog.51cto.com/husheng/5934277
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报