<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2668" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>Hey all,</DIV>
<DIV> </DIV>
<DIV>How do I fix the following error:</DIV>
<DIV><begin error></DIV>
<DIV>File to load: passcard.txt</DIV>
<DIV> </DIV>
<DIV>Traceback (most recent call last):<BR> File
"D:\Python24\password.py", line 82, in -toplevel-<BR>
load_file(sitelist,filename)<BR> File "D:\Python24\password.py", line 51,
in load_file<BR> [site,ID,passcard] =
string.split(in_line,",")<BR> File "D:\Python24\lib\string.py", line 292,
in split<BR> return s.split(sep, maxsplit)<BR>AttributeError:
'list' object has no attribute 'split'</DIV>
<DIV><end error></DIV>
<DIV><begin code></DIV>
<DIV>#This is for a password protected program to store passwords.<BR>import
string<BR>password = "hello"<BR>sitelist = {}</DIV>
<DIV> </DIV>
<DIV>def main_menu():<BR> print "1) Add a login info
card"<BR> print "2) Lookup a login info
card"<BR> print "3) Remove a login info
card"<BR> print "4) Print Login info
list"<BR> print "5) Load info"<BR> print "6)
Save info"<BR> print "9) Exit"</DIV>
<DIV> </DIV>
<DIV>def add_site():<BR> print "Add a login info
card"<BR> site = raw_input("Site: ")<BR> ID
= raw_input("User ID: ")<BR> passcard = raw_input("Password:
")<BR> sitelist[site] = [ID,passcard]</DIV>
<DIV> </DIV>
<DIV>def lookup_site():<BR> print "Lookup a login info
card"<BR> site = raw_input("Site: ")<BR> if
sitelist.has_key(site):<BR> print "The
ID is: ",sitlist[site][0]<BR> print
"The password is: ",sitelist[site][1]<BR>
else:<BR> print site," was not
found."</DIV>
<DIV> </DIV>
<DIV>def remove_site():<BR> print "Remove a login info
card"<BR> site = raw_input("Site:
")<BR> if
sitelist.has_key(site):<BR> del
sitelist[site]<BR>
else:<BR> print site," was not
found."</DIV>
<DIV> </DIV>
<DIV>def print_login_info():<BR> print "Login
Info"<BR> for site in
sitelist.keys():<BR> print "Site:
",site," \tID: ",sitelist[site][0]," \tPassword: ",sitelist[site][1],"\n"</DIV>
<DIV> </DIV>
<DIV>def load_file(sitelist,filename):<BR> in_file =
open(filename,"r")<BR> while
1:<BR> in_line =
in_file.readlines()<BR> if in_line ==
"":<BR>
break<BR> in_line =
in_line[:-1]<BR> [site,ID,passcard] =
string.split(in_line,",")<BR>
sitelist[site] = sitelist</DIV>
<DIV> </DIV>
<DIV>def save_file(sitelist,filename):<BR> out_file =
open(filename,"w")<BR> for site in
sitelist.keys():<BR>
out_file.write(site+","+sitelist[site][0]+","+sitelist[site][1]+"\n")<BR>
out_file.close()</DIV>
<DIV> </DIV>
<DIV>print "The Password Program"<BR>print "By Nathan Pinno"<BR>print<BR>answer
= raw_input("What is the password? ")<BR>while password !=
answer:<BR> print "The password is
incorrect."<BR> answer = raw_input("What is the password?
")</DIV>
<DIV> </DIV>
<DIV>print "Welcome to the second half of the program."<BR>while
1:<BR> main_menu()<BR> menu_choice =
int(raw_input("Choose an option (1-6, or 9: "))<BR> if
menu_choice == 1:<BR>
add_site()<BR> elif menu_choice ==
2:<BR>
lookup_site()<BR> elif menu_choice ==
3:<BR>
remove_site()<BR> elif menu_choice ==
4:<BR>
print_login_info()<BR> elif menu_choice ==
5:<BR> filename = raw_input("File to
load: ")<BR>
load_file(sitelist,filename)<BR> elif menu_choice ==
6:<BR> filename = raw_input("Filename
to save as: ")<BR>
save_file(sitelist,filename)<BR> elif menu_choice ==
9:<BR> break<BR>
else:<BR> print "That's not an
option!"<BR>print "Have a nice day!"<BR><end code></DIV>
<DIV> </DIV>
<DIV>Thanks in advance,</DIV>
<DIV>Nathan Pinno,<BR></DIV></BODY></HTML>