简体   繁体   中英

How to check a valid csv file?

I have a csv file in this format

"emails"
"foo.bar@foo.com"
"bar.foo@foo.com"
"foobar@foo.com"

If a file is not in the above format, I want to throw a file format error. How to do this?

只需使用csv模块读取文件-检查第一行是否与您期望的标头匹配,然后使用正则表达式(重新模块)检查后续各行中的电子邮件地址...抛出适当的异常或终止程序措施失败。

只需尝试cutplace即可验证您的csv是否符合指定格式。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM