pythonizer icon indicating copy to clipboard operation
pythonizer copied to clipboard

Octal numbers need to get 0o in python output

Open snoopyjc opened this issue 3 years ago • 2 comments

In python 2.7, 0123 was an octal constant, same as in perl, but in Python 3+ you have to put 0o in front of your octal numbers, so this case would be 0o123.

snoopyjc avatar Nov 09 '21 03:11 snoopyjc

Fix in perlscan.pm:

   $cut=length($val);
   if($cut > 1 && substr($ValPy[$tno], 0, 1) eq '0') {	# issue 22
        $ValPy[$tno] = "0o".substr($ValPy[$tno], 1);	# issue 22
   }							# issue 22
}elsif( $s=~/\w/  ){

snoopyjc avatar Nov 09 '21 03:11 snoopyjc

Fixed in https://github.com/snoopyjc/pythonizer

snoopyjc avatar Feb 07 '22 16:02 snoopyjc