1# Basic syntax:
2import ast
3ast.literal_eval(your_string)
4
5# Example usage:
6# Say you want to convert a string like:
7'(0,0,0), (0,0,1), (1,1,0)' # or like
8'((0,0,0), (0,0,1), (1,1,0))'
9# to a tuple of tuples like:
10((0,0,0), (0,0,1), (1,1,0))
11
12# Import the Abstract Syntax Trees package:
13import ast
14your_string = '(0,0,0), (0,0,1), (1,1,0)'
15
16# Convert to tuple of tuples:
17your_tuple = ast.literal_eval(your_string)
18print(your_tuple)
19--> ((0,0,0), (0,0,1), (1,1,0))