I hava get a list of string and save to csv file
imagesList=['img/201507/27/e731.gif','img/201507/29/e771.png']
myCSV =csv.writer(open('data.csv', 'wb'))
myCSV.writerow([imagesList])
open csv file like this:
"['img/201507/27/e731.gif', 'img/201507/29/e771.png']"
but what I want to get like this
"["img/201507/27/e731.gif", "img/201507/29/e771.png"]"
so I change the code
import csv
imagesList=['img/201507/27/e731.gif','img/201507/29/e771.png']
imgList = []
for image in imagesList:
image = '"'+image+'"'
imgList.append(image)
myCSV =csv.writer(open('data1.csv', 'wb'))
myCSV.writerow([imgList])
but I get:
"['""img/201507/27/e731.gif""', '""img/201507/29/e771.png""']"
so how can I delete the single quotes(')?