<!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 style="COLOR: #000000; FONT-FAMILY: Times New Roman" bgColor=#ffffff>
<BLOCKQUOTE id=0><LABEL id=HbSession SessionId="304588207"></LABEL>
<DIV>Hi all,</DIV>
<DIV> </DIV>
<DIV>Why does invalid syntax popup?</DIV>
<DIV> </DIV>
<DIV>Here is the latest code:</DIV>
<DIV># This is the code for a password protected program to store
passwords.<BR>password = "hello"<BR>print "The Password Program"<BR>print
"Copyright 2005 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? ")<BR>def main_menu_command():<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) Save login list"<BR>
print "6) Open Login list"<BR> print "9) Exit"</DIV>
<DIV> </DIV>
<DIV>def load_login_command(site,filename):<BR> in_file =
open(filename,"r")<BR> while
1:<BR> in_line =
in_file.readline()<BR> if
len(in_file) ==
0:<BR>
break<BR> in_line =
in_line[:-1]<BR> [site,id,passcard]
= string.split(in_line,",")<BR>
list[site] = id and passcard<BR>
in_file.close()<BR> <BR>def
save_login_command(site,filename):<BR> out_file =
open(filename,"w")<BR> for x in
site.keys():<BR>
out_file.write(x+","+sites[x]+"\n")<BR>
out_file.close()</DIV>
<DIV> </DIV>
<DIV>def add_login_command(site,filename):<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_login_command(site,filename):<BR> print
"Lookup a login info card"<BR> site
= raw_input("Site: ")<BR> if
sitelist.has_key(site):<BR>
print "The ID is:
",sitelist[site][0]<BR>
print "The password is:
",sitelist[site][1]<BR>
else:<BR>
print site," was not found."</DIV>
<DIV> </DIV>
<DIV>def remove_login_command(site,filename):<BR> print
"Remove a login info card"<BR> site
= raw_input("Site: ")<BR> if
sites.has_key(site):<BR>
del sitelist[site]<BR>
else:<BR>
print site," was not found."</DIV>
<DIV> </DIV>
<DIV>def display_login_command(site,filename):<BR> print
"Login Info"<BR> for x in
site.keys():<BR>
print "Site: ",sitelist," \tID: ",sitelist[site]," \tPassword:
",sitelist[site]<BR> print</DIV>
<DIV> </DIV>
<DIV><BR>menu_choice = "0"<BR>list = {}<BR>print "Welcome to the second half
of the program."<BR>main_menu()<BR>while menu_choice !=
"9":<BR> menu_choice = raw_input("Choose an option:
")<BR> if menu_choice ==
"1":<BR>
add_login_command()<BR> elif menu_choice ==
"2":<BR>
lookup_login_command()<BR> elif menu_choice ==
"3":<BR>
remove_login_command()<BR> elif menu_choice ==
"4":<BR>
display_login_command()<BR> elif menu_choice ==
"5":<BR> filename =
raw_input("Filename to save: ")<BR>
save_login_command()<BR> elif menu_choice ==
"6":<BR> filename =
raw_input("Filename to load: ")<BR>
load_login_command()<BR>print "Have a nice day!"</DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV>Nathan Pinno<BR><A
href="http://www.npinnowebsite.ca/">http://www.npinnowebsite.ca/</A></DIV></BLOCKQUOTE>
<P></P></BODY></HTML>