#coding:gbk #filename = 'text.txt' #warting = 'please set u login_name : ' #with open(filename,'a') as file_object: # file_object.write(input(warting)) #filename = 'guest_book.txt' #warting = 'please set u login_name : ' #while True: # i = input(warting) # print('nice to mee you! '+i) # with open(filename,'a') as file_object: # file_object.write(i+'\n') filename = 'love_python_why.txt' warting = 'why u love python? ' warting += '\ntell me why: ' while True: i = input(warting) print('Think you for your pool .') with open(filename,'a') as file_object: file_object.write(i+'\n')#强调,换行符需要加到write里面,而不是用户的input
最后修改:2022 年 12 月 05 日
© 允许规范转载