15_python实操案例一


任务一:
# 一、①使用print方式进行输出(输出的目的地是文件)
fp = open('D:/test.txt', 'w')
print("奋斗成就更好的你", file=fp)
fp.close()
任务二:
# ②使用文件读写操作
with open('D:/test1.txt', 'w') as file:
    file.write("奋斗成就更好的你")
任务三:
# 输出天气预报
print('星期日', '今天')
print('---------------------------------------------')
print('08时', '11时', '14时', '17时', '20时', '23时')
print('0℃ ', '6℃ ', '10℃ ', '4℃ ', '1℃ ', '0℃ ',)
print('---------------------------------------------')
print('明 天 ', '2/23 ', '2℃/11℃')
print('星期二 ', '2/24 ', '2℃/11℃')
print('星期三 ', '2/25 ', '2℃/11℃')
print('星期四 ', '2/26 ', '2℃/11℃')
print('星期五 ', '2/27 ', '2℃/11℃')
print('星期六 ', '2/28 ', '2℃/11℃')
任务四:
# 机票购买
print('✈国内\t♚国际.港澳台\t↘发现低价')
print('--------------------------------------')
print('航班类型\t⊙单程\t⊙往返\t⊙多程(含缺口程)')
print('出发城市:北京')
print('到达城市:长春')
print('出发日期:2020-3-8')
print('返回日期:yyyy-MM-dd')
print('--------------------------------------')
print('\t\t☐带儿童  ☐带婴儿')
print('\t\t\t ________')
print('\t\t\t|__搜索__|')

 

 
 


 

 
posted @ 2022-08-05 13:30  tuyin  阅读(96)  评论(0)    收藏  举报