Character string to ascii value conversion
Emile van Sebille
emile at fenx.com
Thu Mar 9 18:35:20 EST 2000
More information about the Python-list mailing list
Thu Mar 9 18:35:20 EST 2000
- Previous message (by thread): Getting a list of ALL functions in a class
- Next message (by thread): Character string to ascii value conversion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I spent a few minutes looking for a function to convert a binary string into a number for a project I'm working on. I didn't spot anything, so I wrote this: def asc(strval): if len(strval) == 0: return 0 elif len(strval) == 1: return long(ord(strval)) else: return 256*(asc(strval[:-1]))+ord(strval[-1]) It basically emulates ord() for longer character strings. My question is where is this in the standard library? If-it-is-ly y'rs, Emile van Sebille emile at fenx.com -------------------
- Previous message (by thread): Getting a list of ALL functions in a class
- Next message (by thread): Character string to ascii value conversion
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list