Convert code from actionscript to python -


i trying convert project actionscript python. here actionscript code:

private static function parsestuff(_arg1):string{             var _local4:string;             var _local5:int;             var _local2 = "";             var _local3:int;             while (_local3 < _arg1.length) {                 _local4 = _arg1.substr(_local3, 1);                 _local5 = _local4.charcodeat(0);                 if ((((_local5 >= 48)) && ((_local5 <= 57)))){                     _local4 = string((int(_local4) ^ 1));                 };                 _local2 = (_local2 + _local4);                 _local3++;             };             return (_local2);         } 

and here attemp in python

local4='' local5=0 local2='' local3 = 0 while (local3<len(arg1)):   local4 = arg1[1:]   local5 = int(local4[0].encode("hex"))   if ((((local5 >= 48)) , ((local5 <= 57)))):     local4 = str((int(local4) ^ 1))   local2 = (local2 + local4)   local3 = local3+1  print local2 

for unknown reason, python code not give same value. doing wrong? me?

is want?

local4='' local5=0 local2='' local3 = 0   while (local3<len(arg1)):   local4 = arg1[local3:local3+1]   local5 = ord(local4[0])   if ((((local5 >= 48)) , ((local5 <= 57)))):     local4 = str((int(local4) ^ 1))   local2 = (local2 + local4)   local3 = local3+1  print local2 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -