Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time, datetime
- def rAccessFile(file): ##Opens a file to write in to, then closes
- what = input("What do you want to do with this file? \nREAD\nWRITE\nOVERWRITE\nCLOSE").lower()
- if what.startswith("r"):
- file1 = open(file, "a+")
- print("Below are the files contents.\n" + file1.read())
- file1.seek(0)
- print(file1.read())
- time.sleep(3)
- what = input("What do you want to do now? \nREAD\nWRITE\nOVERWRITE\nCLOSE").lower()
- if what.startswith("w"):
- file1 = open(file, "a+")
- wtw = input("What would you like to add to the file?\n")
- file1.write("\n" + wtw + "\n")
- file1.seek(0)
- print("Below are the files new contents.\n" + file1.read())
- print(file1.read())
- time.sleep(3)
- what = input("What do you want to do now? \nREAD\nWRITE\nOVERWRITE\nCLOSE").lower()
- if what.startswith("o"):
- file1 = open(file, "w+")
- print(file1.read())
- wtw = input("What would you like to write in the file?")
- file1.write(wtw + "\n")
- print("Below are the files new contents.", file1.read())
- what = input("What do you want to do now? \nREAD\nWRITE\nOVERWRITE\nCLOSE").lower()
- if what.startswith("c"):
- print("Goodbye!")
- print("Which file would you like to access?\n (If the file doesn't exist, it will be created with whatever name you type.)")
- time.sleep(1)
- f2a = input(">>>")
- if ".txt" in f2a:
- rAccessFile(f2a)
- else:
- print("I want to see this")
- f2a.join(f".txt")
- rAccessFile(f2a)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement