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


Groups > comp.lang.python > #74952

Re: How to extract digit from a number?

Date 2014-07-21 15:26 -0500
From Tim Chase <python.list@tim.thechases.com>
Subject Re: How to extract digit from a number?
References <12e1f726-c083-49db-86bd-1c9ae3151b2a@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.12151.1405974457.18130.python-list@python.org> (permalink)

Show all headers | View raw


On 2014-07-21 13:14, fl wrote:
> 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?
> 
> 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]

You don't specify *what* is wrong or what constitutes "does not
work".  If you provide an example of what you *do* want, folks here
can help you get closer to the code you need to do what you intend.

-tkc

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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