Help: C char bits operations to python converting
Aahz Maruch
aahz at panix.com
Tue Sep 26 19:52:07 EDT 2000
In article <8qr6au$hr4$1 at nnrp1.deja.com>, <gangli at msn.com> wrote:
>
>How could I convert following C statments to Python?
> char tmp_ch, tmp_ch0, tmp_ch1;
> tmp_ch = 'K' - 'A'; /* -> 10 */
> tmp_ch0 = ('N' - 'A') << 4; /* -> -48 */
> tmp_ch1 = tmp_ch+ tmp_ch0; /* -> -38 */
Use the built-in ord() function.
--
--- Aahz (Copyright 2000 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het <*> http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
"Perhaps God rewards martyrs, but life seldom does..." --Ulrika O'Brien
More information about the Python-list
mailing list