Python-print

复制代码
 1 # 输出数字
 2 print(520)
 3 print(13.14)
 4 
 5 # 输出字符串
 6 print('helloworld')
 7 print("helloworld")
 8 
 9 # 输出含有运算符的表达式
10 print(1 + 2)
11 print(2 * (1 + 2))
12 
13 # 将数据输出到文件中
14 # PS:1.所指定的盘符存在
15 #    2.使用file=
16 # a+:如果文件不存在就创建,存在就在文件内容的后面追加
17 fp = open('E:/text.txt', 'a+')
18 print('helloworld', file=fp)
19 fp.close()
20 
21 # 不进行换行输出
22 print('hello', 'world', 'python')
复制代码

 

posted @   Xxiaoyu  阅读(30)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
点击右上角即可分享
微信分享提示