Are there any other better ways to access a single bit of string of digits?
fl
rxjwg98 at gmail.com
Sun May 31 14:36:35 EDT 2015
Hi,
I am new to Python. I would manipulate a string of hex numbers. If the first
digit is bigger than 7, the first two digits are required to add 4.
For example, '8022_3345' will be changed to '8422_3345'. The
underscore between two 4-digit's was generated previously (i.e.
it is already in the .txt file).
I have not tried to read the .txt file to a list yet. I just try the
following:
tmp
['12345678', '23456789', '3456789a', '456789ab']
Each 8-digit hex number is assigned to a variable, such as:
digit8=tmp[0]
I can compare digit8[0] with 7, and so on...
The underscore, I think, can be removed by first a string replace.
My question here is:
Do you have better ways than my tmp, digit8 operation?
Thanks,
More information about the Python-list
mailing list