python - 我正在尝试在 python 中创建密码系统。我不知道这有什么问题
问题描述
import os
pasword = os.environ['PASSWORD']
askpassword = input("Enter Password : ")
if askpassword == (pasword)
print ("Correct Password, you now have access to this code")
if not askpassword == (pasword)
exit()
这是我的代码,它告诉我这个错误:
File "main.py", line 6
if askpassword == 'pasword'
^
SyntaxError: invalid syntax
顺便说一句,我正在使用https://replit.com
解决方案
简单的修复 - 你忘记了一个冒号。
if askpassword == (pasword):
在 python 中,所有控制结构都需要在它们之后有一个冒号。
推荐阅读
- azure - Azure 通知中心 - 从 GCM 迁移到 FCM
- android - React Native Scroll View 设备方向横向
- java - 如何从 C# 统一代码中调用服务类中的方法
- c# - 从动作中获取回调值
- angular - 如何在 Angular 中初始化单选按钮组的 value 属性?
- javascript - 带有内部图标的Javascript onclick动作问题
- spring - 在 Jenkins 构建的 docker 容器中设置正确的工作目录的问题
- android - 使用 enqueueUniquePeriodicWork 的 PeriodicWork 不起作用
- php - 删除匹配记录的 CSV 行
- java - 当软键盘可见时,CollapsingToolbarLayout 不会折叠