必须加# encoding: utf-8否则报错

SyntaxError: Non-ASCII character '\xe6'

 

# encoding: utf-8
import re
regex= ur"\d{4}" #正则表达式
if re.match(regex,"2020-2-02"):
    print 111
else:
    print 222

 

返回111

相关文章:

  • 2022-12-23
  • 2021-10-04
  • 2022-02-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
猜你喜欢
  • 2021-05-27
  • 2023-03-22
  • 2021-12-18
  • 2022-01-08
  • 2021-12-17
  • 2022-12-23
相关资源
相似解决方案