I have a string:
ip = 'MULTIPOLYGON (((1790.0 15563.0, 1791.0 15553.0, 1790.0 15551.0, 1789.0 15549.0, 1791.0 15547.0)), ((1752.0 15451.0, 1753.0 15449.0, 1762.0 15449.0, 1764.0 15451.0, 1761.0 15451.0, 1758.0 15454.0, 1756.0 15453.0)))'
I would like to convert it to the following format, but as int;
[((1790.0 , 15563.0) , (1791.0 , 15553.0) , (1790.0 , 15551.0) , (1789.0 , 15549.0) , (1791.0 , 15547.0)) ,((1752.0 , 15451.0) , (1753.0 , 15449.0) , (1762.0 , 15449.0) , (1764.0 , 15451.0) , (1761.0 , 15451.0) , (1758.0 , 15454.0) , (1756.0 , 15453.0))]
What I tried so far?
ip = 'MULTIPOLYGON (((1790.0 15563.0, 1791.0 15553.0, 1790.0 15551.0, 1789.0 15549.0, 1791.0 15547.0)), ((1752.0 15451.0, 1753.0 15449.0, 1762.0 15449.0, 1764.0 15451.0, 1761.0 15451.0, 1758.0 15454.0, 1756.0 15453.0)))'
st = ip[15:-2]
#s = st.split(',')
x = st.replace(", ", ") (")
res=[x.replace(" ", " , ")]
list(map(int, res))
This converts to the above format as string and not int. I get the following error: ValueError: invalid literal for int() with base 10:
How do I solve it?