In mainland europe, the csv files are separated through semicolons because numbers have , in them instead of . So, i am trying to write a semicolonSeparatedList same as commaSeparatedList but with ; instead of ,:
_semicolonsepitem = Combine(OneOrMore(Word(printables, excludeChars=';') +
Optional( Word(" \t") +
~Literal(";") + ~LineEnd() ) ) ).streamline().setName("semicolonItem")
semicolonSeparatedList = delimitedList( Optional( quotedString.copy() | _semicolonsepitem, default="") ).setName("semicolonSeparatedList")
However parsing:
Name;Ref;Address
results in
['Name']
instead of
['Name', 'Ref', 'Address']
Can anyone help?
Have you tried the csv module from python?
There, you can specify the delimiter easily.
import csv
with open('eggs.csv', 'rb') as csvfile:
spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
Edit after Birei's comment : I just took example from docs python page, you can input anything you want as a delimiter for csv reader :
' '
','
';'
'a'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With