1.print()函数可以输出哪些内容?
- 数字
print(520)
print(99.1)
- 字符串
print('helloworld')
print("helloworld")
- 含有运算符的表达式
print(3+1)
2.print()函数可以将内容输出的目的地
- 显示器
控制台
- 文件(1.指定盘符存在 2.使用file=fp)
fp = ('D:/text.text','a+') #如果文件不存在就创建,已存在就加在内容后面
print('helloworld',file = fp)
fp.close()
3.print()函数输出形式
- 换行
- 不换行(输出内容在一行当中)
print('hello','world','python')