Advertisement
182days

Write to File

May 10th, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. while True:
  2.     input1=input("What is your name? (enter 'STOP' to end the program)")
  3.     file=open("text.txt","a")
  4.     file.write(input1)
  5.     if input1=="STOP":
  6.         break
  7.     file.close()
  8.  
  9.     input2=input("What is your nationality?")
  10.     file=open("text.txt","a")
  11.     file.write(" " + input2 + "\n")
  12.     file.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement