T
towers
Hi
I'm probably doing something stupid but I've run into a problem
whereby I'm trying to add a csv file to a zip archive - see example
code below.
The csv just has several rows with carriage return line feeds (CRLF).
However after adding it to an archive and then decompressing the line
endings have been converted to just line feeds (LF).
Does anyone know if this is a bug or am I just doing something wrong?
Many Thanks,
Damon
****************************************************************************
import zipfile
zipFile = zipfile.ZipFile('LocalZipFile.zip', 'a',
zipfile.ZIP_DEFLATED)
dfile = open('LocalCSVFile.csv', 'r')
zipFile.writestr('test.csv',dfile.read())
dfile.close()
zipFile.close()
****************************************************************************
I'm probably doing something stupid but I've run into a problem
whereby I'm trying to add a csv file to a zip archive - see example
code below.
The csv just has several rows with carriage return line feeds (CRLF).
However after adding it to an archive and then decompressing the line
endings have been converted to just line feeds (LF).
Does anyone know if this is a bug or am I just doing something wrong?
Many Thanks,
Damon
****************************************************************************
import zipfile
zipFile = zipfile.ZipFile('LocalZipFile.zip', 'a',
zipfile.ZIP_DEFLATED)
dfile = open('LocalCSVFile.csv', 'r')
zipFile.writestr('test.csv',dfile.read())
dfile.close()
zipFile.close()
****************************************************************************