Python:正则表达式。。。不工作?

2024-05-19 09:14:38 发布

您现在位置:Python中文网/ 问答频道 /正文

我有这个代码:

    # If the username isn't alpha-numerics (inc: _, -, ., )
    if re.match('^[a-zA-Z0-9 _\-\.]+$', repName) == False:
        print 'DECLINE: '+repName
    else:
        print 'ACCEPTED: '+repName

当我用这个字符串测试它时:它是从一个网站抓取的 我把这个还给你:

ACCEPTED: ɢᴀꜱᴛÑ?ɪᴄ

为什么要通过?还有为什么Python会改变字符串呢?在


Tags: the字符串代码alphareifmatchusername

热门问题