python编程从入门到实践练习10-4:访客名单 with open('guest_book.txt','a') as file_object: while True: visitor = input('请输入用户名(输入"q"退出):') if visitor == 'q': break else: print(f'Hello {visitor}!') file_object.write(f'username is {visitor} accessed the system!\n')