Skip to content
Advertisement

Tag: utf-16

Decode UUID 4 as a Python string

I would like to generate a UUID v4 string starting from the uuid import from the Python standard library. I know I can cast a UUID to str by doing str(uuid.uuid4()), however I am trying to understand what the bytes in that class instance mean. While trying to decode those bytes I see all sorts of errors, either the string

Convert utf-16 to utf-8 using python

I am trying to convert a huge csv file from utf-16 to utf-8 format using python and below is the code: But this code uses lots of memory and fails with Memoryerror. Please help me with an alternate method. Answer an option is to convert the file line by line: or you could open the files with your desired encoding:

Advertisement