Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91587

Are there any other better ways to access a single bit of string of digits?

X-Received by 10.236.31.100 with SMTP id l64mr25590847yha.55.1433097396660; Sun, 31 May 2015 11:36:36 -0700 (PDT)
X-Received by 10.50.109.137 with SMTP id hs9mr96873igb.1.1433097396633; Sun, 31 May 2015 11:36:36 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!z60no4869559qgd.1!news-out.google.com!kd3ni33206igb.0!nntp.google.com!h15no695244igd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Sun, 31 May 2015 11:36:35 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=76.27.220.131; posting-account=SZ_svQkAAACWRFG2bDA-zgq8ILyl4-vo
NNTP-Posting-Host 76.27.220.131
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <68680e6e-b914-4bef-b16b-1fa48b00eaf2@googlegroups.com> (permalink)
Subject Are there any other better ways to access a single bit of string of digits?
From fl <rxjwg98@gmail.com>
Injection-Date Sun, 31 May 2015 18:36:36 +0000
Content-Type text/plain; charset=ISO-8859-1
X-Received-Bytes 1765
X-Received-Body-CRC 3114936799
Xref csiph.com comp.lang.python:91587

Show key headers only | View raw


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,

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Are there any other better ways to access a single bit of string of digits? fl <rxjwg98@gmail.com> - 2015-05-31 11:36 -0700
  Re: Are there any other better ways to access a single bit of string of digits? Denis McMahon <denismfmcmahon@gmail.com> - 2015-05-31 19:51 +0000
    Re: Are there any other better ways to access a single bit of string of digits? fl <rxjwg98@gmail.com> - 2015-05-31 13:08 -0700

csiph-web