vendredi 6 mars 2015

How do I select a name from a list on python?


Vote count:

0




More help with my banking ATM school project. The problem is that I have created a program that lets the users enter a name into a save elsewhere, but I cant select a name from that save to use again. This is my code.



f1 =open('C:\NameAgeFile', 'r')
filedata = f1.read()
f1.close()

print filedata


This prints a list of all the registered users on the shell, but how can I make it so that if the user wants to log back in, say under the name "Michael" on the list, and then retrieve the bank balance for that user?



balance_user = 500
f1 =open('N:\userFile', 'r')
filedata = f1.read()
f1.close()

print filedata
print "Welcome to the Banking Bank PLC public ATM service"
print "If you do have an account allready, select your name from the list of registered users."
user = raw_input("Please enter your ATM account name and insert your Banking Card. If you do not have an ATM account, please insert your Banking Card and enter New_User.")
if user == "New_User":
print "Weclome to the Banking Bank PLC ATM service."
user = raw_input ("Please enter an ATM account name that you wish to use to log onto the Banking Bank ATMs")

f1 =open('N:\userFile', 'a+')
print >> f1,user


print "Welcome", user, "to the Banking Bank PLC ATM service."
print "You have been given £100 for signing up. Please log out and back on to bank."


asked 1 min ago







How do I select a name from a list on python?

Aucun commentaire:

Enregistrer un commentaire