返回

Python__01--print()

发布时间:2022-12-16 13:35:05 242
# python# 数据

1 打印输出print()

print() 函数用于打印输出,是python中最常见的一个内置函数

1.1 使用方式

  1. 可以输出数字

    print(520)
    
  2. 可以输出字符串

    print('helloworld')
    
  3. 含有运算符的表达式

    print(4+1)
    
  4. 将数据输出到文件盘符存在

    file=fp=open('D:/text.txt','a+')
    print('helloworld',file=fp)
    fp.close()
    
  5. 不进行换行输出

    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: 请添加链接描述

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(0)
按点赞数排序
用户头像
精选文章
thumb 中国研究员首次曝光美国国安局顶级后门—“方程式组织”
thumb 俄乌线上战争,网络攻击弥漫着数字硝烟
thumb 从网络安全角度了解俄罗斯入侵乌克兰的相关事件时间线
下一篇
python 异步编程 2022-12-16 13:27:27