NUAA-iCal-Python icon indicating copy to clipboard operation
NUAA-iCal-Python copied to clipboard

请问参数验证为什么不用正则表达式呢

Open Zhang-Siyang opened this issue 7 years ago • 3 comments

比如 https://github.com/NUAA-Open-Source/NUAA-iCal-Python/blob/master/NUAAiCal/main.py#L84 中

if not (xq == '1' or xq == '2'):

1或2可以用'[12]'这样的正则表达式去匹配

同一文件 L68

if '-' in xn:

如果用'20/d{2}-20/d{2}'来匹配会省后边再次验证的代码

Zhang-Siyang avatar Sep 29 '18 13:09 Zhang-Siyang

学习了学习了,你是怎么找到这个项目的?

有兴趣提个 PR?

Triple-Z avatar Sep 29 '18 14:09 Triple-Z

我也在做校历导出,Google到的这个项目

我尝试提交一下PR

Zhang-Siyang avatar Sep 30 '18 17:09 Zhang-Siyang

@Zhang-Siyang 哈哈,好的,期待你的 PR ~

Triple-Z avatar Sep 30 '18 17:09 Triple-Z