from string to tuple python code example
Example 1: python string to tuple
l = list('abcd') # ['a', 'b', 'c', 'd']
l = map(None, 'abcd') # ['a', 'b', 'c', 'd']
l = [i for i in 'abcd'] # ['a', 'b', 'c', 'd']
import re # importing regular expression module
l = re.findall('.', 'abcd')
print(l) # ['a', 'b', 'c', 'd']
Example 2: string to tuple python
string = "mystring"
tuple1 = tuple(string)
# ('m', 'y', ' ', 's', 't', 'r', 'i', 'n', 'g')
tuple2 = string,
# ("my string",)