Advertisement
nosthemerc

add_line

Nov 15th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. from sys import argv
  2.  
  3. script, imported_file = argv
  4.  
  5. print("Opening", imported_file)
  6. print("""
  7.     Would you like to add lines to %s?
  8.     \n RETURN for yes
  9.     \n ^C for no
  10.     """) % imported_file
  11. raw_input("...")
  12.  
  13. test_text = open("imported_file", "r+")
  14. print(test_text.read())
  15.  
  16. print("""
  17.     What would you like to add to this text?
  18.     Add three lines.
  19.     """)
  20. added_line1 = "\n" + raw_input("Line 1: ")
  21. added_line2 = "\n" + raw_input("Line 2: ")
  22. added_line3 = "\n" + raw_input("Line 3: ")
  23.  
  24. #error on this line
  25. test_text.write(added_line1 + added_line2 + added_line3)
  26.  
  27. print("Here is your new file:")
  28. print(test_text.read())
  29.  
  30. test_text.close()
  31. print("Hit RETURN to close program.")
  32. raw_input("...")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement