Mark Lawrence
2015-10-27 22:24:04 UTC
Hi!
I want to reads two files and create simple dictionary. Input file contain more than 10000 rows
diz5 = {}
lines = i.rstrip("\n").split("\t")
diz5.setdefault(lines[0],set()).add(lines[1])
diz3 = {}
lines = i.rstrip("\n").split("\t")
diz3.setdefault(lines[0],set()).add(lines[1])
how can manage better this reading and writing?
thanks so much
https://docs.python.org/3/library/csv.htmlI want to reads two files and create simple dictionary. Input file contain more than 10000 rows
diz5 = {}
lines = i.rstrip("\n").split("\t")
diz5.setdefault(lines[0],set()).add(lines[1])
diz3 = {}
lines = i.rstrip("\n").split("\t")
diz3.setdefault(lines[0],set()).add(lines[1])
how can manage better this reading and writing?
thanks so much
https://docs.python.org/3/library/csv.html#csv.DictReader
https://docs.python.org/3/library/csv.html#csv.DictWriter
https://docs.python.org/3/library/csv.html#csv.excel_tab
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor