Help: C char bits operations to python converting
gangli at msn.com
gangli at msn.com
Wed Sep 27 09:23:31 EDT 2000
In article <8qrcr7$fhe$1 at panix3.panix.com>,
aahz at panix.com (Aahz Maruch) wrote:
> 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.
It only help convert "tmp_ch = 'K' - 'A';", but not others
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list