I think, if I understand you correctly, you're looking for the built-in
function ord:

ord(...)
    ord(c) -> integer
    
    Return the integer ordinal of a one-character string.

Hope this helps.

On Thu, 2002-10-03 at 02:01, enrico secco wrote:
> Hi python people,
> I'm trying to read an old binary format file and I use the struct module.
> Any step I must read 32 bytes with a format
> fs = "=11s1s4s1H14s"    (I did try with fs = "=11s1c4s1H14s" too)
> and in the second part of the resultant tuple (1s or 1c) I must read
> the type of information following:
> 'C' for Character,
> 'N' for Numerical ...
> but to obtain this information I must before do and binary and operation
> with 127.
> Now, for numeric, e.g., I obtain '\xce' that correspond with an exadecimal
> 0xce that
> I can use to 'and' with 127, BUT i don't be able to obtain the Numeric
> information
> from the Char information.
> Trivial in C language but in Python?
> Thanks and best regards.
> Enrico

-- 
Reggie Dugard <[EMAIL PROTECTED]>
Merfin, LLC


_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to