więc to jest mój kod i chcę ukryć moje hasło, ale nie wiem jak. Rozejrzałem się i żadne z nich nie pasuje do mojego kodowania, to jest aktualne kodowanie. Chodzi mi o to, że widziałem show = "*", a także getpass, ale nie wiem, jak umieścić je w tym kodowaniu. im przy użyciu python 2.7.3 i im kodowania na raspberry pi.python Ukrywanie raw_input
ans = True
while ans:
print("""
-------------
| 1. Shutdown |
| 2. Items |
-------------
""")
ans=raw_input("""
Please Enter A Number: """)
if ans == "1":
exit()
elif ans == "2":
pa=raw_input("""
Please Enter Password: """)
if pa == "zombiekiller":
print("""
----------------
| 1. Pi password |
| 2. Shutdown |
----------------
""")
pe=raw_input ("""
Please Enter A Number: """)
if pe == "1":
print ("""
Pi's Password Is Adminofpi""")
import time
time.sleep(1)
exit()
elif pe == "2":
exit()
else:
print("""
You Have Entered An Inccoredt Option. Terminating Programm""")
import time
time.sleep(1)
exit()
else:
print("""
You Have Entered An Inccorect Password. Terminating Programm""")
import time
time.sleep(1)
exit()
Użyj [getpass.getpass()] (http://docs.python.org/2/library/getpass#getpass.getpass). – falsetru
możliwy duplikat [Uzyskiwanie hasła do wiersza poleceń w Pythonie] (http://stackoverflow.com/questions/9202224/getting-command-line-password-input-in-python) – IanAuld