Skip to content

1.7异常处理 #16

Description

@wym3342732342
def test(str):
    str= input("请输入一个字符串: ")
    if str!='ABC':
        raise NameError('无效输入,请重新输入...')
try:
    test('ABC')
except NameError as e:
    print(e)
else:
    print("yes!")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions