如何检查字符串是否匹配此模式?
大写字母、数字、大写字母、数字...
例如,这些将匹配:
A1B2
B10L1
C1N200J1
这些不会('^' 表示问题)
a1B2
^
A10B
^
AB400
^
最佳答案
import re
pattern = re.compile("^([A-Z][0-9]+)+$")
pattern.match(string)
关于python - 检查字符串是否匹配模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12595051/