trouble converting c++ bitshift to python equivalent

nanodust at gmail.com nanodust at gmail.com
Thu May 24 16:14:37 EDT 2007


hello all

i am relatively new to python, catching on, but getting stuck on
simple thing:

i have two string bytes i need to push into a single (short) int, like
so in c:

   temp = strBuf[2];

   temp = (temp<<7)+(strBuf[1]);

c code works, but having trouble getting python to perform same
function!

keep getting type & operator errors (i apparently can't bitshift on
str or int?)

curious what the best way is to do this, in python...

i'll stick w/ it & post when i sort it


meanwhile, any help greatly appreciated




More information about the Python-list mailing list