convert string to tuple python code example
Example 1: convert a tuple into string python
tuple_ = 1, 2, 3, 4, 5
str(list(tuple))
Example 2: python string to tuple
l = list('abcd')
l = map(None, 'abcd')
l = [i for i in 'abcd']
import re
l = re.findall('.', 'abcd')
print(l)
Example 3: how to add strings in tuple in python
First, convert tuple to list by built-in function list().
You can always append item to list object.
Then use another built-in function tuple() to
convert this list object back to tuple.
You can see new element appended to original tuple representation.
by tutorialspoint.com
happy coding :D
Example 4: string to tuple python
string = "mystring"
tuple1 = tuple(string)
tuple2 = string,