The code is attached below. Basically I am taking a substring of
variable m, and using "buffer" instead of slicing.

However, the application of int on that buffer start correctly from
the offset, but it scans all the way to the end, instead of stopping
at the length of the buffer.

It works however, if I apply str function to output of buffer
function.

-A


(Pdb) m = "AA1234AA"
(Pdb) x = buffer(m, 2, 4)
(Pdb) x
<read-only buffer for 0x2a9d0c18a0, size 4, offset 2 at 0x2a9d0cb7f0>
(Pdb) int(x)
*** ValueError: invalid literal for int() with base 10: '1234AA'
(Pdb) m = "AA1234AA"
(Pdb) m = "AA1234"
(Pdb) x = buffer(m, 2, 4)
(Pdb) int(x)
1234
(Pdb)
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to