Help: C char bits operations to python converting

fredrik at pythonware.com fredrik at pythonware.com
Wed Sep 27 15:34:46 CEST 2000


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

it sure does.  try again.

</F>


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list