python – Password generator + storage console application

This is my code to generate and store the password locally hash in the txt file.
I would like to ask you kindly if you can check my code. By the way, it is encoded as a console application. I am currently working on the manufacture of GUI. Thanks in advance.

import randomly
import hashlib

class randomPass ():
action = & # 39; & # 39;
def __init __ (self):
# PREPARE
self.passdic = {}

self.num_lines = sum (1 for the open line (& # 39; passwords.txt & # 39;))
with open (& # 39; passwords.txt & # 39 ;, & # 39; r & # 39;) as rf:
for i in the range (self.num_lines):
self.content = rf.readline ()
self.content = list (self.content.split ())
self.passdiction[self.content[0]]= self-contained[1]

        self.leng = 14
self.action = & # 39; & # 39;
self.gPass = & # 39; & # 39;
# work as I want
self.myPass = & # 39; & # 39;

print (& # 39; perform one of the actions & # 39;)
while self.action! = & # 39; break & # 39 ;:
print (& # 39; new action please & # 39;)
self.action = input ()
yes self.action == & # 39; generate & # 39;
print (& # 39; determine the length of the generated password, we recommend more than 14 characters & # 39;)
self.leng = int (input ())
self.gPass = self.generateRandomPassWord (self.leng)
print (& # 39; generated & # 39;)
elif self.action == & # 39; read & # 39 ;:
self.passRead ()
elif self.action == & # 39; save & # 39 ;:
self.savePass (self.gPass)
plus:
print (self.action + & # 39; is not a valid action & # 39;)



def generateRandomPassWord (self, lengthOfPassword = 14):
znaky =[& # 39; "& # 39 ;," & # 39; ", & # 39;! & # 39;, & # 39; # & # 39;, & # 39; $ & # 39;, & # 39;% & # 39;, & # 39; & & # 39;, & # 39; (& # 39;, & # 39;) & # 39;, & # 39; * & # 39;, & # 39; + & # 39;, & # 39 ;, & # 39;, & # 39; - & # 39;, & # 39 ;. & # 39;, & # 39; / & # 39;, & # 39; 0 & # 39;, & # 39; 1 & # 39;, & # 39; 2 & # 39;, & # 39; 3 & # 39 ;,
& # 39 ;, 4 & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39; 8 & # 39 ;, & # 39; 9 & # 39 ;, & # 39;: & # 39 ;, & # 39 ;; & # 39 ;, & # 39;<', '=', '>& # 39;, & # 39 ;? & # 39;, & # 39; @ & # 39;, & # 39; A & # 39;, & # 39; B & # 39;, & # 39; C & # 39;, & # 39; D & # 39;, & # 39; E & # 39;, & # 39; F & # 39;, & # 39; G & # 39 ;,
& # 39; & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39; L & # 39 ;, & # 39; M & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, P & # 39 ;, & # 39 ;, & # 39; R & # 39 ;, & # 39; S & # 39 ;, & # 39; T & # 39;, & # 39; U & # 39;, & # 39; V & # 39;, & # 39; W & # 39;, & # 39; X & # 39;, & # 39; And & # 39;, & # 39; Z & # 39;, & # 39;[& # 39 ;,
& # 39;]& # 39;, & # 39; ^ & # 39 ;, & # 39; _ & # 39;, & # 39; `& # 39;, & # 39; a & # 39;, & # 39; b & # 39;, & # 39; c & # 39;, & # 39; d & # 39;, & # 39; e & # 39;, & # 39; f & # 39;, & # 39; g & # 39;, & # 39; h & # 39;, & # 39; i & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39; n & # 39 ;, , & # 39; or & # 39 ;, & # 39; p & # 39 ;,
& # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & # 39; v & # 39 ;, & # 39 ;, & # 39 ;, & # 39 ;, & & 39 ;, & # 39 ;, & & # 39 ;, & # 39 ;, & # 39; {& # 39 ;, & # 39; | & # 39 ;, & # 39;} & # 39;, & # 39; ~ & # 39;]pword = & # 39; & # 39; .join ([znaky[random.randint(0, len(znaky) - 1)] for i in the range (lengthOfPassword)])
back pword

def savePass (self, generatePassword):
print (& # 39; to save the generated password type your password & # 39;)
self.myPass = hashlib.md5 ((input (). encode (& # 39; utf-8 & # 39;))). hexdigest ()
yes self.myPass on self.passdic:
print (& your key password already exists! & # 39;)
plus:
with open (& # 39; passwords.txt & # 39 ;, & # 39; a & # 39;) as af:

af.write (self.myPass + & # 39; + generatePassword + & # 39;  n & # 39;)

self.passdiction[self.myPass] = generate password
print (& # 39; stored password & # 39;)

def passRead (auto):
print (& # 39; to read the generated password type your password & # 39;)
self.myPass = hashlib.md5 ((input (). encode (& # 39; utf-8 & # 39;))). hexdigest ()
yes self.myPass on self.passdic:
print (self.passdicted[self.myPass])
plus:
print (& # 39; we regret that your password does not exist & # 39;)

a = randomPass ()
print (& # 39; end & # 39;)