Re: python docs for beginner programmer?
In article <[email protected]>, [email protected] says... > > Deep_Feelings writes: > > > should i try them then after a month of reading i discover that they > > are - for example - not suitable for beginners OR should i ask here > > first ? :) > > You should take on the task of educating yourself. The official Python > docs are an excellent resource. If you're self-admittedly someone who > gets bored quickly, though, that's not a problem anyone but you can > solve. Been doing Python for a week or so now and I must agree that the official python docs are a fantastic resource. I'm not sure how good they would be for someone with no previous programming language experience but they seem to be pretty thourough, at least for one beginning the language. http://docs.python.org/tutorial/index.html -- http://mail.python.org/mailman/listinfo/python-list
Question of UTF16BE encoding / decoding
Hello,
I have an encoded string in the form "004e006100700061006c006d", if you
split on every 4 characters it decodes to a single character.
I have come up with this:
name = '004e006100700061006c006d'
name2 = ""
for x in range(0, len(name), 4):
name2 = name2 + chr(int(name[x:x+4], 16))
Is there a better way to do this using name.decode() that would then
also work with .encode()?
I have tried .decode("utf-16-be"), which I beleive is the format here,
but I am getting the error:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-
11: ordinal not in range(128)
And my debugger seems to show a load of unicode when it breaks.
Thank you!
--
http://mail.python.org/mailman/listinfo/python-list
Re: Question of UTF16BE encoding / decoding
In article , [email protected] says... > > > import binascii > s = '004e006100700061006c006d' > h = binascii.unhexlify(s) > print h.decode('utf-16-be') > > -Mark And: name2 = name2.encode("utf-16-be") print binascii.b2a_hex(name2) to re-encode, Thank you, much appreciated! -- http://mail.python.org/mailman/listinfo/python-list
