Also - <br>
<br>
menu_choice =
input("Choose an option: ")<br>
<br>
input() is always bad. Use int(raw_input(""Choose an option: "))
instead. input() evaluates your input as a Python expression - I could
select 9 by entering 5+4<br>
<br>
or, I could enter sys.exit() and drop to DOS (or whatever it's running
on.) or far more malicious code, like deleting everything on C: drive<br>
<br>
list[site] = id and passcard <br>
I'm not sure if that's real or a comment. Possibly you meant list[site] = id + passcard ?<br>
<br>
<br>
...Or, it could be this - <br>
<br>
if
site.has_key(site):<br>
print "The ID is:
",id(site)<br>
print "The password is:
",passcard(site)<br>
<br>
id(site) - if you have functions called id and passcard, I can't see
them, if id and passcard are collections (list/dictionary) I can't see
them. <br>
<br>
If they are functions, id() is a builtin Python function. <br>
<br>
If they are collections, then the correct way to access member items is to use id[site] or<br>
passcard[site].<br>
<br>
But, now I'm guessing. Please post error message. And, if you need to
post code, please post all relevant code, I recommend
<a href="http://www.rafb.net/paste/">http://www.rafb.net/paste/</a> to have it formatted nicely and even colour
coded.<br>
<br>
Regards, <br>
<br>
Liam Clarke<br>
<br><br><div><span class="gmail_quote">On 7/5/05, <b class="gmail_sendername">Liam Clarke</b> <<a href="mailto:cyresse@gmail.com">cyresse@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
What error messages are you getting? Please post the full message.<br><br><div><div><span class="e" id="q_104e4ab0a5832a6b_1"><span class="gmail_quote">On 7/5/05, <b class="gmail_sendername">Nathan Pinno</b> <<a href="mailto:falcon3166@hotmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
falcon3166@hotmail.com
</a>> wrote:</span></span></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><span class="e" id="q_104e4ab0a5832a6b_3">
<blockquote><label></label>
<div>What's wrong with this code? I'm using 2.2.3 if this helps.</div>
<div> </div>
<div>#This is for a password protected program to store passwords.</div>
<div>password = "hello"<br>print "The Password Program"<br>print "Copywrite
2005. All Rights Reserved."<br>print<br>answer = raw_input("What is the
password? ")<br>while password != answer:<br> print "The
password is incorrect."<br>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) Save login list"<br>
print "6) Open Login list"<br> print "9) Exit"</div>
<div> </div>
<div>def load_login(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(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()<br> <br>menu_choice = 0<br>list =
{}<br>print "Welcome to the second half of the program."<br>print
main_menu()<br>while menu_choice != 9:<br> menu_choice =
input("Choose an option: ")<br> if menu_choice ==
1:<br> print "Add a login info
card"<br> site = raw_input("Site:
")<br> id = raw_input("User ID:
")<br> passcard =
raw_input("Password: ")<br>
list[site] = id and passcard<br> elif menu_choice ==
2:<br> print "Lookup a login info
card"<br> site = raw_input("Site:
")<br> if
site.has_key(site):<br>
print "The ID is:
",id(site)<br>
print "The password is:
",passcard(site)<br>
else:<br>
print site," was not found."<br> elif menu_choice ==
3:<br> print "Remove a login info
card"<br> site = raw_input("Site:
")<br> if
sites.has_key(site):<br>
del numbers[site]<br>
else:<br>
print site," was not found."<br> elif menu_choice ==
4:<br> print "Login
Info"<br> for x in
site.keys():<br>
print "Site: ",x," \tID: ",numbers[x]," \tPassword:
",numbers[x]<br>
print<br> elif menu_choice ==
5:<br> filename =
raw_input("Filename to save: ")<br>
save_login(list,filename)<br> elif menu_choice ==
6:<br> filename ==
raw_input("Filename to load: ")<br>
load_login(list,filename)<br>print "Have a nice day!"<br></div>
<div>Thanks,</div>
<div>Nathan Pinno<br>Crew, McDonalds Restaurant, Camrose, AB Canada<br><a href="http://www.npinnowebsite.ca/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.npinnowebsite.ca/</a></div>
</blockquote>
<p></p></span></div>
<br>_______________________________________________<br>Tutor maillist - <a href="mailto:Tutor@python.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Tutor@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://mail.python.org/mailman/listinfo/tutor</a><br><br><br></blockquote></div><br><br><br>-- <br>'There is only one basic human right, and that is to do as you damn well please.<br>And with it comes the only basic human duty, to take the consequences.'
</blockquote></div><br><br><br>-- <br>'There is only one basic human right, and that is to do as you damn well please.<br>And with it comes the only basic human duty, to take the consequences.'