2019年12月16日 明日科技 python语言基础

with open('test3.txt','w',encoding='utf-8') as f:
    print('this is test3.txt',file=f) #用print 输出到文件

 

a=int(input('number:'))
b= a if a>4 else 3 # 条件表达式简化
print(b)

 

posted @ 2019-12-16 21:07  小圣庄  阅读(219)  评论(0编辑  收藏  举报