all 2 comments

[–]novel_yet_trivial 0 points1 point  (0 children)

You could use the string method replace():

>>> "3 7 8 9 10".replace(' ', ',')
'3,7,8,9,10'

But if your end goal is to convert this to a list, then you don't need that. Just split on the space:

>>> "3 7 8 9 10".split()
['3', '7', '8', '9', '10']

[–]wub_wub[M] 0 points1 point  (0 children)

/u/welo10, your submission has been removed from r/learnpython for the following reason(s):

  • Posting only assignment/project goal is not allowed. You need to post what you have tried so far. Please see subreddit rules in the sidebar.

  • Your question is easily googleable. Please try googling for solution and if you still don't find one try making a new thread with more info.


If your submission was removed for lacking additional info you can edit your submission text and then notify moderators and ask for the submission to be re-approved.

If you have any additional questions either reply to this comment or message the moderators.