Say I have a string that's of the same form a tuple should be, for example, "(1,2,3,4,5)"
. What's the easiest way to convert that into an actual tuple? An example of what I want to do is:
tup_string = "(1,2,3,4,5)"
tup = make_tuple(tup_string)
Just running tuple()
on the string make the whole thing one big tuple, whereas what I'd like to do is comprehend the string as a tuple. I know I can use a regex for this, but I was hoping there's a less costly way. Ideas?