+ 2

how to create text file in python?

im trying to make a function to create a file for a small program. not sure where im going wrong on creating the file enter file to save hashes in ifnot we will make it: 1 my error----> Traceback (most recent call last): File "C:\Users\mikey\Desktop\hash.py", line 7, in <module> f = open(hfile, 'wa') ValueError: Invalid mode ('wa') for some reason it worked earlier but not now?

18th Dec 2017, 4:36 AM
Michael Darnell
Michael Darnell - avatar
3 Réponses
+ 2
nvm yall i figured it out xD XD look at my new codes??? run on pc not sololearn :P https://code.sololearn.com/cC2nSFywJvbh/#py https://code.sololearn.com/cWNLGpVoliwi/#py
18th Dec 2017, 4:42 AM
Michael Darnell
Michael Darnell - avatar
+ 2
Are you sure that it was working before? I believe you can't use w and a in same time, since they do opposite things in terms of overriding.
18th Dec 2017, 4:48 AM
Dima Makieiev
Dima Makieiev - avatar
+ 2
That second code tho, why are you still in Python2?
18th Dec 2017, 4:56 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar