Python Forum
How to compressing and decompressing a list to a .csv file? Python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to compressing and decompressing a list to a .csv file? Python
#2
It looks like you have the decompression fine. The file writes correctly when I run it, although note that you need parents after file.close to actually call the close method.

Since you are importing csv, you might as well use csv.writer to write the file. Then you would use csv.reader to read the file. You can read each row as a list. They will be lists of strings, so you will need to use int to convert the indexes back to integers to reconstruct the sentence. Check out the csv documentation (https://docs.python.org/3/library/csv.html) and see if you can get it to work with that.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: How to compressing and decompressing a list to a .csv file? Python - by ichabod801 - Dec-29-2016, 03:29 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020