python - String explosion when using Dict(zip(fieldnames, data)) function and csv.DictWriter -
I am trying to run the following code, but I constantly get "Dict field names do not have fields: 's 'C', 't', 'd', 'e', 'v'. ') As out_file: writer = csv.DictWriter (out_file, delimiter =', ', field name = area name, quoting = csv.QUOTE_ALL) Author: .writeheader () data in line for print (public, field name, data) : Author. Author (line) set and speak = ['diff', 'min', 'max', 'mode', 'mean', 'steady', 'var']; DatSet = [2.88, 21.78, 24.67, 22.04, 23.06, 0.92, 0.85]; Second = Dictionary (zip (set endpac, dataset)); Csv_dict_writer (filePath + 'textFirst.csv, setAndSpike, second)
I have done a search for a similar topic, and they have changed all the different answers - in the CSV quote Use modules do not use audits in the DictWriter module, my keys are not to raise a data set, to raise the data set - but the keys come in the form of a string that has exploded.
Strange manner, when I try to do it with dict (zip (setAndSpike, datSet)
it just aligns.
I am looking for any help, even if there is a direction on this subject even if the answer has already been given, I am not getting the same problem as the solution, and this Nothing looks simple but
I'm running the code in Spider 2, via Anaconda 3 and Python 3.4. I can come in the form of a new user and this is because I am.
Thank you in advance for your patience and support
csv_dict_writer (filepath + 'TextFirst CSV', Set EndSpeck, second)
It seems that the third parameter of csv_dict_writer
is considered to be a list of decat, but you only have one word Seeing it are wrapping in the list, wrap it in the list.
csv_dict_writer (filePath + 'textFirst.csv, setAndSpike, [second])
Comments
Post a Comment