Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The Matrix
#4
(Jun-20-2019, 07:10 AM)mcmxl22 Wrote: perfringo, I'm relatively new to Python and programming in general so I don't know all the tricks yet. Thanks for the suggestion but it returns a list of integers and I need a list of strings.

Thats why I made suggestion Smile

Why do you need list of strings? There is no difference if printing out:

>>> print(1)
1
>>> print('1')
1
However, if you really need strings then slight modification of list comprehension provided can help:

>>> [str(num) for num in range(10)]
['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
The Matrix - by mcmxl22 - Jun-20-2019, 05:58 AM
RE: The Matrix - by perfringo - Jun-20-2019, 06:43 AM
RE: The Matrix - by mcmxl22 - Jun-20-2019, 07:10 AM
RE: The Matrix - by perfringo - Jun-20-2019, 07:29 AM
RE: The Matrix - by ThomasL - Jun-20-2019, 08:06 AM
RE: The Matrix - by DeaD_EyE - Jun-20-2019, 09:29 AM
RE: The Matrix - by nilamo - Jun-20-2019, 03:43 PM
RE: The Matrix - by ThomasL - Jun-21-2019, 05:30 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020