我正在制作一個小程序,用戶在其中創建一個帳戶,但是由于某種原因,在代碼傳遞的這一部分中,沒有人可以解釋這一點嗎?def create_password(): while True: password = '#' not_allowed_characters = '!#¤%&/()=?^\'.,<>' for c in list(password): 0 + 0 if c in not_allowed_characters: print(c + ' is not allowed') pass #pass does nothing how can i fix this if 0 is 0: print(1)create_password()
1 回答

ITMISS
TA貢獻1871條經驗 獲得超8個贊
pass
根據定義什么都不做。這就是它的用途:作為無操作者,占位符表示語法需要語句但您不想執行任何操作的時間。
我懷疑您想要的是continue
,這會循環。
添加回答
舉報
0/150
提交
取消