100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > Python输出函数print

Python输出函数print

时间:2023-02-19 13:17:31

相关推荐

Python输出函数print

1、输出数字

print(520)

print(98.5)

2、输出字符串

print('helloworld')

print("helloworld")

3、含有运算符的表达式

print(3+1)

4、将数据输出到文件中,注意点:1.所指定的盘符存在;2.使用file = fg

fg = open('D:/text,txt','a+') #a+:如果文件不存在就创建,存在就在文件内容后追加。

print('helloworld',file = fg)

fg.close()

5、不进行换行输出(输出内容在一行当中)

print(’hello','word','python')

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。