0
Someone please help me with my python password generator!
I want my password generator to create a .txt file and save my passwords there, but it won't. Why? https://code.sololearn.com/ck2uaDEkJ31s
10 Answers
+ 5
I have found the problem:
In, line 22, "file = file.open("pass.txt", "w")", your code is using the undefined variable "file", so it displays an error. To fix this, you have to replace "file.open()" with "open()". Also, you should try to use "with" instead so the file is automatically closed and because it's more efficient.
Answer:
Change, line 22, "file = file.open("pass.txt", "w")" with "file = open("pass.txt", "w")"
Recommendation:
Use "with" instead, which looks like:
with open("pass.txt", "w") as f:
f.write(Password)
f.close()
+ 4
CR34TUR3
I think import module don t work in sololearn. I mean playground
+ 4
SoundInfinity
I can input 2 numbers :)) by "enter"
+ 1
The program works fine.
I got a PW đ
+ 1
But file. open will not work on Playground!
+ 1
Petr Yeah, I realized that, I didn't know that could be done. So, I assumed that you couldn't send 2 inputs.
0
An other question is why do you want to save it in a file
0
Maybe it runs with pydroid3 on your mobile
0
But then you have to choise a valid folder for your file
0
Thank you Soundifinity!