I am doing a simple password manager in python, the user needs to input platform, user and password.
I tryied to fill the csv in case it was because the csv was empty, also i defined both variables as a list.
I keep getting an error while trying to check if the input platform is already in the csv file.
This is the part of the code:
if n=="1":
fo=open(reqfile,'r')
data=csv.reader(fo)
datatoread=list(data)
while check==False:
newline.append(input("introduce platform:").lower)
for x in range(len(datatoread)-1):
if newline[0]==datatoread[x[0]]:
print("You already setup an username and password for this platform, please change the platform")
check=False
else:
check=True
The output when i print(newline) just after the append statement:
[<built-in method lower of str object at 0x037AF680>]
This is where i put the break:
fo=open(reqfile,'r')
data=csv.reader(fo)
datatoread=list(data)
while check==False:
newline.append(input("introduce platform:"))
for x in range(len(datatoread)):
print(newline)
print(datatoread)
if newline[0]==datatoread[x[0]]:
print("You already setup an username and password for this platform, please change the name of the platform")
check=False
newline.pop()
break
else:
check=True
break
The output is:
['youtube']
[['Platform', 'Username', 'Password']]
Also with the same error
The error:
File "/PassMan.py", line 27, in if newline[0]==datatoread[x[0]]: TypeError: 'int' object is not subscriptable
If you need all the code, there's my github repo: https://github.com/DavidGarciaRicou/PasswordManagerPython