Convert List of String to a String separated by a delimiter

前端 未结 4 1939
心在旅途
心在旅途 2021-01-31 14:45

Whats the best way to convert a list(of string) to a string with the values seperated by a comma (,)

4条回答
  •  醉话见心
    2021-01-31 15:26

    My solution:

    string = ["a","2"]\n
    newstring = ""
    endOfString = len(string)-1
    for item in string:
        newstring = newstring + item
    if item != string[endOfString]:
        newstring = newstring ","'
    

提交回复
热议问题