a = 'HM 893 chrM:4929 106H45M'
items = a.strip().split()
for index, item in enumerate(items):
print(str.isalpha(item), str.isdigit(item), str.isalnum(item))
输出结果为:
True False True
False True True
False False False
False False True
a = 'HM 893 chrM:4929 106H45M'
items = a.strip().split()
for index, item in enumerate(items):
print(str.isalpha(item), str.isdigit(item), str.isalnum(item))
输出结果为:
True False True
False True True
False False False
False False True
本文标题:python-字符串判断数据形式-2020-01-09
本文链接:https://www.haomeiwen.com/subject/bkuuactx.html
网友评论