File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import os
2+ import os .path
23import time
34
45def process ():
@@ -9,18 +10,27 @@ def process():
910 if lines == "exit-editor\n " :
1011 break
1112 else :
12- fo .seek (0 )
1313 fo .writelines (lines )
1414
1515if __name__ == "__main__" :
1616 print ("Welcome to Python-Notepad! Made with <3 by WilliamAfton-codes\n " )
1717
1818 filename_input = str (input ("What would you like the file to be called?: " ))
19- ext_input = str (input ("What would you like the extension to be? (Don't type the '.'): " ))
19+ print ("Don't type the '.' in the extension" )
20+ ext_input = str (input ("What would you like the extension to be? (Leave blank to default to .txt): " ))
21+ if ext_input == "" :
22+ ext_input = "txt"
23+ else :
24+ pass
2025 filename = filename_input + "." + ext_input
26+
27+ file_exists = os .path .exists (filename )
28+ if file_exists == True :
29+ print ("A file with this name in this directory already exists, Python-Notepad will add text to the end" )
30+
2131 fo = open (filename , "a" )
2232
2333 print ("Loading text editor..." )
2434 time .sleep (1 )
2535 print ("\n Type 'exit-editor' to stop writing." )
26- process ()
36+ process ()
You can’t perform that action at this time.
0 commit comments