Advertisement
netbyte

Daily Programmer - Python - #1

Mar 28th, 2012
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. from sys import argv
  2.  
  3. script, filename = argv
  4.  
  5. target = open(filename, 'w')
  6.  
  7. cow = raw_input("What's your name? ")
  8. pig = raw_input("How old are ya!? ")
  9. duck = raw_input("What's your name on reddit? ")
  10.  
  11. print "Now I'm going to ask you for three lines."
  12.  
  13. line1 = raw_input("line 1: ")
  14. line2 = raw_input("line 2: ")
  15. line3 = raw_input("line 3: ")
  16.  
  17. print "I'm going to write these to a file."
  18.  
  19. target.write(line1)
  20. target.write("\n")
  21. target.write(line2)
  22. target.write("\n")
  23. target.write(line3)
  24. target.write("\n")
  25. target.write("Your name is %r, you are %r years old and your username is %r" % (cow, pig, duck))
  26.  
  27. print "And finally, we close it."
  28. target.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement