Sunday, 15 March 2015

python - CSV delimiter that is read from a file -


I have a JSON settings file that has the settings of my script, a part of the settings csv.writer () < / Code> is the delimiter for.

When it is being read in variable settings and give it to me it: {'delimiter': u ','}

When I try to use it in csv.writer (out, ** settings) I get the following error: TypeError: "delimiter" 1-character string Should be .

To fix this now I do this: Settings ["delimiter"] = Settings ["Delimiter"]. Encoded ("UTF-8")

... but I am thinking that there is no way, I can read this file in the first place, it will mean that I do Have not been done for?

Edit:

The settings file is read as:

  Settings with open (file): Details = json.load ( Settings,    

No, JSON uses standard Unicode whole (this is a good thing P> HTML>

No comments:

Post a Comment