printf的几种用法
#"print"用法
#1.输出字符串(用单引号或双引号或三引号引起来)
print("aa")
print("'hello'") #输出 'hello'
print('hello')
print("3+2-9") #做字符串,不计算,原样输出
#2.打印输出数字
print(520)
print(1314)
#3.计算输出含有运算符的表达式
print(2 + 3 * 6)
print(10 - 9 * 5 / 2)
#4.将数据输出到文件中 注意盘符要存在,并且使用file = 变量的形式
fp = open('D:/text.txt','a+')# D:/text.是数据输出的文件,a 是以读写的方式打开文件,若文件不存在,就创建;若文件存在,就追加
print('hello world',file=fp) #把helloworld输出到fp表示的文件中
fp.close()
#不进行换行输出(输出内容在一行)
print('hello','world','aa') #输出 hello world aa