Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sys import argv
- script, filename = argv
- print("Opening", filename)
- print("""
- Would you like to add lines to %s?
- \n RETURN for yes
- \n ^C for no
- """) % filename
- raw_input("...")
- test_text = open(filename, 'r')
- print(test_text.read())
- print("""
- What would you like to replace this text with?
- Add three lines.
- """)
- test_text = open(filename, 'w')
- test_text.write(
- raw_input("Line 1: ") + '\n' +
- raw_input("Line 2: ") + '\n' +
- raw_input("Line 3: ") + '\n'
- )
- test_text.close()
- test_text = open(filename, 'r')
- print("\n Here is your new file:\n")
- print(test_text.read())
- test_text.close()
- print("Hit RETURN to close program.")
- raw_input("...")
- #worked out of an 'IOError: [Errno 0] Error'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement