python - How to convert text like \u041b\u044e\u0431\u0438 to normal text while data download? -
when bulk download gae data written in russian, text
u'\u041b\u044e\u0431\u0438\u043c\u0430\u044f \u0430\u043a\u0446\u0438\u044f \u0432\u0435\u0440\u043d\u0443\u043b\u0430\u0441\u044c! \u0412 \u0440\u0435\u0441\u0442\u043e\u0440\u0430\u043d\u0430\u0445 \u0415\u0432\u0440\u0430\u0437\u0438\u044f ""3 \u0440\u043e\u043b\u043b\u0430 \u043f\u043e \u0446\u0435\u043d\u0435 1""! \u0421 9 \u043f\u043e 12 \u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f! \u0422\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u0438 4 \u0434\u043d\u044f! \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 evrasia.spb.ru, 88005050145 \u0438 008'
the following bulkloader
used:
transformers: - kind: mykind connector: csv connector_options: property_map: - property: texts external_name: texts
what should decoded?
upd. i've tried following
python_preamble: - import: codecs ... - property: texts external_name: texts export_transform: codecs.decode('unicode_escape')
but getting error:
unable assign value 'codecs.decode('unicode_escape')' attribute 'export_transform': code export_transform did not return callable. code: "codecs.decode('unicode_escape')". in "bulkloader.yaml", line 22, column 25
somehow bulkloader documentation got removed google site, don't know read export_transform
usage.
without knowing gae , workings got thoughts on may or may not forward:
- if try print string (ex:
print the_string
) , written thing in question useeval
(ex:print eval(the_string)
). or if want make unicode object, use:the_string=eval(the_string)
. - by looking @ errormessage "... export_transform did not return callable ..." , actual name "export_transform" guess export_transform needs callable transformation-function. try define 1 externally or use
lambda
-function.
hope helps you...
Comments
Post a Comment