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


Groups > comp.lang.python > #74951

How to extract digit from a number?

X-Received by 10.68.236.129 with SMTP id uu1mr8493804pbc.1.1405973658429; Mon, 21 Jul 2014 13:14:18 -0700 (PDT)
X-Received by 10.140.92.225 with SMTP id b88mr34975qge.25.1405973658338; Mon, 21 Jul 2014 13:14:18 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!h18no5214151igc.0!news-out.google.com!j6ni3315qas.0!nntp.google.com!j15no1871935qaq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Mon, 21 Jul 2014 13:14:18 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=64.229.140.25; posting-account=SZ_svQkAAACWRFG2bDA-zgq8ILyl4-vo
NNTP-Posting-Host 64.229.140.25
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <12e1f726-c083-49db-86bd-1c9ae3151b2a@googlegroups.com> (permalink)
Subject How to extract digit from a number?
From fl <rxjwg98@gmail.com>
Injection-Date Mon, 21 Jul 2014 20:14:18 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.python:74951

Show key headers only | View raw


Hi,

I see the following example on line, but it does not work. I do not know what is
wrong. Could you correct it for me?


Thanks,



........................
I'm not sure what [1, 1, 0, 0, 0, 0, ...] has to do with 128, but if you want the 
base 10 digits:

>>> a = 1234
>>> [int(d) for d in str(a)]
>>> [1, 2, 3, 4]

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


Thread

How to extract digit from a number? fl <rxjwg98@gmail.com> - 2014-07-21 13:14 -0700
  Re: How to extract digit from a number? Tim Chase <python.list@tim.thechases.com> - 2014-07-21 15:26 -0500
    Re: How to extract digit from a number? fl <rxjwg98@gmail.com> - 2014-07-21 13:42 -0700
      Re: How to extract digit from a number? Roy Smith <roy@panix.com> - 2014-07-21 16:53 -0400
      Re: How to extract digit from a number? Tim Chase <python.list@tim.thechases.com> - 2014-07-21 15:57 -0500

csiph-web