第一章
1、输出函数
#可以输出数字
print(50)
print(63.2)
#可以输出字符串
print("helloWorld")
print('helloWorld')
#含有运算符的表达式
print(1+3)
#将数据输出到文件中,注意点:1.所指定的盘符存在,2.使用file=fp
fp=open('D:/text.txt','a+') #a+如果文件不存在就创建,存在就在文件内容的后面继续追加
print('helloworld',file=fp)
fp.close()
#不进行换行输出
print("hello",'world','Python')
2、转义字符与原字符
#转移字符
print("hello\nworld") #\+转移功能的首字母 n-->newline的首字母表示换行
print("hello\tworld")
print('helloo\tworld')
print('hello\rworld') #world将hello进行了覆盖
print('hello\bworld') #\b是退一个格,将o退没了
print('http:\\\\www.baidu.com') #\\表示\
print('老师说:\'大家好\'') #\'表示'
#原字符,不希望字符串中的转义字符起作用,就使用原字符,就是在字符串之前加上r,或R
print(r'hello\nworld')
#注意事项,最后一个字符不能的反斜杠
#print(r'hello\nworld\')
print(r'hello\nworld\\')