[Tutor] changing char list to int list isn't working

Jim Mooney cybervigilante at gmail.com
Sat May 4 06:13:02 CEST 2013


I'm turning an integer into a string so I can make a list of separate
chars, then turn those chars back into individual ints, but the
resulting list still looks like string chars when I print it. What am
I doing wrong?


listOfNumChars = list(str(intNum))
for num in listOfNumChars:
    num = int(num)

print(listOfNumChars)

# result of 455 entered is ['4', '5', '5']

--
Jim Mooney

“For anything that matters, the timing is never quite right, the
resources are always a little short, and the people who affect the
outcome are always ambivalent.”


More information about the Tutor mailing list