Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #97000
| Path | csiph.com!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail |
|---|---|
| Return-Path | <lac@openend.se> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'strings.': 0.07; 'cc:addr:python-list': 0.09; '[1,': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'subject:into': 0.09; 'successive': 0.09; 'python': 0.10; 'index': 0.13; '>thanks,': 0.16; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'integers,': 0.16; 'message- id:@fido.openend.se': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'url:tutor': 0.16; 'string': 0.17; 'first.': 0.18; 'laura': 0.18; '2015': 0.20; 'cc:addr:python.org': 0.20; 'cc:2**1': 0.22; 'fairly': 0.22; 'int,': 0.22; 'sep': 0.22; 'chris': 0.26; 'back.': 0.27; 'this.': 0.28; '-0700,': 0.29; 'received:se': 0.29; 'cc:no real name:2**1': 0.29; 'character': 0.29; 'convert': 0.29; 'url:mailman': 0.30; 'url:python': 0.33; 'url:listinfo': 0.34; 'tue,': 0.34; 'list': 0.34; 'something': 0.35; 'but': 0.36; 'url:org': 0.36; 'assigned': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'list.': 0.37; 'wanted': 0.37; 'mailing': 0.38; 'url:mail': 0.40; 'easy': 0.60; 'your': 0.60; 'header:Message-Id:1': 0.61; 'back': 0.62; 'tutor': 0.66; 'results': 0.66; 'header:In-reply- to:1': 0.84 |
| To | Chris Roberts <thecjguy1@gmail.com> |
| cc | python-list@python.org, lac@openend.se |
| From | Laura Creighton <lac@openend.se> |
| Subject | Re: Python, convert an integer into an index? |
| In-reply-to | <e6e800a2-a64c-47dc-87b3-c6d32b6fca2f@googlegroups.com> |
| References | <e6e800a2-a64c-47dc-87b3-c6d32b6fca2f@googlegroups.com> |
| Comments | In-reply-to Chris Roberts <thecjguy1@gmail.com> message dated "Tue, 22 Sep 2015 14:43:55 -0700." |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset="us-ascii" |
| Content-ID | <15925.1442960482.1@fido> |
| Date | Wed, 23 Sep 2015 00:21:22 +0200 |
| X-Greylist | Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [82.96.5.2]); Wed, 23 Sep 2015 00:21:26 +0200 (CEST) |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.73.1442960495.28679.python-list@python.org> (permalink) |
| Lines | 33 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1442960495 news.xs4all.nl 23836 [2001:888:2000:d::a6]:34111 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:97000 |
Show key headers only | View raw
In a message of Tue, 22 Sep 2015 14:43:55 -0700, Chris Roberts writes:
>
>
>(How do I make it into an index? )
>Preferably something fairly easy to understand as I am new at this.
>
>results = 134523 #(Integer)
>
>Desired:
>results = [1, 2, 3, 4, 5, 2, 3] #(INDEX)
>
>Somehow I see ways to convert index to list to int, but not back again.
>
>Thanks,
>crzzy1
You need to convert your results into a string first.
result_int=1234523
result_list=[]
for digit in str(result_int):
result_list.append(int(digit))
digit will be assigned to successive 1 character long strings. Since
you wanted a list of integers, you have to convert it back.
If you are learning python you may be interested in the tutor mailing
list. https://mail.python.org/mailman/listinfo/tutor
Laura
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Python, convert an integer into an index? Chris Roberts <thecjguy1@gmail.com> - 2015-09-22 14:43 -0700
Re: Python, convert an integer into an index? Laura Creighton <lac@openend.se> - 2015-09-23 00:21 +0200
Re: Python, convert an integer into an index? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-23 00:23 +0100
Re: Python, convert an integer into an index? MRAB <python@mrabarnett.plus.com> - 2015-09-23 00:27 +0100
Re: Python, convert an integer into an index? marco.nawijn@colosso.nl - 2015-09-22 23:55 -0700
Re: Python, convert an integer into an index? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-22 23:13 -0400
Re: Python, convert an integer into an index? Anssi Saari <as@sci.fi> - 2015-09-23 12:01 +0300
Re: Python, convert an integer into an index? MRAB <python@mrabarnett.plus.com> - 2015-09-24 14:30 +0100
Re: Python, convert an integer into an index? jmp <jeanmichel@sequans.com> - 2015-09-24 16:14 +0200
Re: Python, convert an integer into an index? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-24 21:26 -0400
Re: Python, convert an integer into an index? Denis McMahon <denismfmcmahon@gmail.com> - 2015-09-23 15:32 +0000
Re: Python, convert an integer into an index? Lorenzo Sutton <lorenzofsutton@gmail.com> - 2015-09-24 18:13 +0200
Re: Python, convert an integer into an index? Tim Daneliuk <tundra@bogus-city.tundraware.com> - 2015-09-23 10:55 -0500
csiph-web