当前位置: 代码迷 >> 综合 >> python编程---example24
  详细解决方案

python编程---example24

热度:76   发布时间:2023-10-18 11:27:54.0

访客:
编写一个程序,提示用户输入其名字;用户作出响应后,将其名字写入到guest.txt文件中。 

filename = 'guest.txt'name = input("Enter your name: ")
with open(filename,'a') as file_object:file_object.write(name + "\n")

 

  相关解决方案