On 2015-09-23 10:01, Anssi Saari wrote:
Dennis Lee Bieber <wlfr...@ix.netcom.com> writes:

On Wed, 23 Sep 2015 00:21:22 +0200, Laura Creighton <l...@openend.se>
declaimed the following:



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))


        Rather wordy... <G>

[int(i) for i in str(1234523)]
[1, 2, 3, 4, 5, 2, 3]

I'm suprised. Why not just:

list(str(results))

In other words, is there something else the list constructor should do
with a string other than convert it to a list?

The OP wanted the result to be a list of ints, not a list of strings.

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to