Converting string to tuple without splitting characters

后端 未结 9 1192
逝去的感伤
逝去的感伤 2020-12-02 19:49

I am striving to convert a string to a tuple without splitting the characters of the string in the process. Can somebody suggest an easy method to do this. Need a one liner.

9条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 20:45

    You can use the following solution:

    s="jack"
    
    tup=tuple(s.split(" "))
    
    output=('jack')
    

提交回复
热议问题