python——编写一个正则表达式模式,匹配由逗号分隔的非空字段组成的任何字符串
发布时间:2022-02-22 14:53:56 266
相关标签:
# Put your pattern inside ''
csv_regex = ''
valid_strings = ['ab1c,de_f,xyz', 'ab1c,de_%^f,xyz', 'abc']
invalid_strings = ['ab1c,, de_f','ab1c,de_f, xyz,']
for s in valid_tests:
print(re.compile(csv_regex).fullmatch(s))
for s in invalid_tests:
print(re.compile(csv_regex).fullmatch(s))
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报