I have a string returnd from a software like \"(\'mono\')\" from that I needed to convert string to tuple .
that I was thinking using ast.literal_eval
Try to this
a = ('mono')
print tuple(a) # <-- you create a tuple from a sequence
#(which is a string)
print tuple([a]) # <-- you create a tuple from a sequence
#(which is a list containing a string)
print tuple(list(a))# <-- you create a tuple from a sequence
# (which you create from a string)
print (a,)# <-- you create a tuple containing the string
print (a)
Output :
('m', 'o', 'n', 'o')
('mono',)
('m', 'o', 'n', 'o')
('mono',)
mono