Removing all commas from list in Python

后端 未结 7 935
旧巷少年郎
旧巷少年郎 2021-01-07 12:26

My issue: I\'d like to add all the digits in this string \'1.14,2.14,3.14,4.14\' but the commas are causing my sum function to not work correctly.
I figured

7条回答
  •  日久生厌
    2021-01-07 13:11

    values=input()         
    l=values.split(",")   
    print(l)
    

    With values=1,2,3,4,5

    the result is ['1','2','3','4','5']

提交回复
热议问题