习题5
1.round(1.7333, 2)四舍五入1.733,保留两位小数
习题6
1.joke = "Isn't that joke so funny?{}"
hilarious = False
print(joke.format(hilarious))
结果: Isnt't that joke so funny?False
习题11
1.print("How old are you?", end=' ') # end = ' ',这一行以' '空格结尾,不需要换行
2.input() # 获取到的是字符串type的值
习题17
扫描二维码关注公众号,回复:
7182275 查看本文章
1.from os.path import exists
exists(file) # 检查文件是否存在,存在返回True,不存在返回False
2.read()一旦运行,文件就会被关闭掉,就无须运行close()了