Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

可能需要更周密的检查 #1

Open
Ray7788 opened this issue Jun 21, 2023 · 0 comments
Open

可能需要更周密的检查 #1

Ray7788 opened this issue Jun 21, 2023 · 0 comments

Comments

@Ray7788
Copy link
Owner

Ray7788 commented Jun 21, 2023

https://github.com/Ray7788/NowCoderPython/blob/26a6eeef80e0cf86a8df8144b4e899249522ed8b/NP79.py#L1

以下是建议版本

import re

input_str = input()

# 正则判断输入的是否是大小写字母

result_low = re.findall(r"[a-z]", input_str)

result_up = re.findall(r"[A-Z]", input_str)
if (input_str in result_low)&nbs***bsp;(input_str in result_up):
    print(ord(input_str))
else:
    print("输入的不是字母")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant