I'm trying to parse CSV files from an external system which I have no control of.
- comma is used as a separator
- when cell contains comma then it's wrapped in quotes and all other quotes are escaped with another quote character.
- (my problem) when cell was not wrapped in quotes then all quote characters are escaped with another quote nonetheless.
Example CSV:
qw""erty,"a""b""c""d,ef""""g"
Should be parsed as:
[['qw"erty', 'a"b"c"d,ef""g']]
However, I think that Python's csv module does not expect quote characters to be escaped when cell was not wrapped in quote chars in the first place.
csv.reader(my_file) (with default doublequote=True) returns:
['qw""erty', 'a"b"c"d,ef""g']
Is there any way to parse this with python csv module ?
'""'inside of double quotes with'\\"'? Then thecsvreader should be able to work normally. - user554546