Hacker News new | past | comments | ask | show | jobs | submit login

The csv library of python has handled every csv i've ever thrown on it, csv is "standardized" enough for that. Just set two things, the delimiter, the escape quote method and be done with it. The output is a list of dictionaries with the column headers as keys, very elegant. The best part is that using the same input you did to read a file you can use to save/modify the file and be sure it will look the same when your client re-opens it. A regexp would take twice the time to write and wouldn't give you half of those features, and it would probably fail at escaping sooner or later, for the same reason as xml can't be parsed with regexps.



While I agree with you, I'm having a lot of trouble handling unicode and windows' latin-1 encodings...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: