I have the following list:
lst = ['SDO_GEOMETRY(2001, NULL, MDSYS.SDO_POINT_TYPE(9971, 18847, NULL), NULL, NULL)',
'SDO_GEOMETRY(2001, NULL, MDSYS.SDO_POINT_TYPE(9971, 19188, NULL), NULL, NULL)',
'SDO_GEOMETRY(2001, NULL, MDSYS.SDO_POINT_TYPE(9972, 18282, NULL), NULL, NULL)',
'SDO_GEOMETRY(2001, NULL, MDSYS.SDO_POINT_TYPE(9977, 19201, NULL), NULL, NULL)',
'SDO_GEOMETRY(2001, NULL, MDSYS.SDO_POINT_TYPE(9989, 18635, NULL), NULL, NULL)']
I would like to extract only the string that contains the number in brackets after MDSYS.SDO_POINT_TYPE. How do I do that?
What I tried so far?
op=[]
for i in lst:
x = (i[46:56])
y = str('('+x+')')
op.append(y)
But, the numbers are not always in position 46-56, how do I optimize that?
Desired output:
['(9971, 1884)',
'(9971, 1918)',
'(9972, 1828)',
'(9977, 1920)',
'(9989, 1863)']