2021年3月5日星期五

How to convert a string filled with numbers to seperate integers in a list? [duplicate]

So basically I want to convert a string which has multiple numbers to seperate integers in a list.

lst = []  s = '12 14 17'  

Basically what I am trying to do is get the lst to be lst = [12,14,17] but I am having difficulty doing this since the string is one whole string and not one string per number.

https://stackoverflow.com/questions/66502176/how-to-convert-a-string-filled-with-numbers-to-seperate-integers-in-a-list March 06, 2021 at 11:47AM

没有评论:

发表评论