python 判断字符串只包含数字字母

Posted on Posted in python

python 判断字符串只包含数字字母

a = 'abc123xyz'
flag = set('1234567890qwertyuioplkjhgfdsazxcvbnm')
if not (set(a.lower()) - flag):
    print("只包含数字字母")

Leave a Reply

Your email address will not be published. Required fields are marked *

19 + 12 =