#可以输出数字
print(96)
print(9.3)
#可以输出字符串
print('helloworld')
#可以输出含有运算符的表达式
print(5+6)
#将数据输出到文件中。注意,1所指的盘符真实存在,2使用file=fp。
fp=open('D:/text.txt','a+')
print('helloworld',file=fp)
fp. close()
#不进行换行输出
print('hello','world','Python')
#转义字符
转义功能的首字母。n-->newline的首字母,表示换行
print('hello\nworld')
print('hello\tworld')#hello与world之间个一个制表格
print('hello\rworld')#world将hello覆盖
print('hello\bworld')#\b是退一个格,将o退掉。
print('http:\\\\www. baidu.com')输出结果为http:\\www. baidu.com #两个\输出结果为一个\
#若要输出'则需要在'前加\,如
print('张三说:\'李四最帅\'')输出结果为
张三说:'李四最帅'
#原字符,不希望字符串里面的字符起作用,就用原字符,就是在字符串之前加r或R。注意事项,最后一个字符不能是反斜杠。
print(r'hello\nworld')输出结果为hello\nworld
#若最后两个字符均为\,则直接输出两个反斜杠。