POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30))

geometry = QgsGeometry.fromWkt( 'MultiPolygon((( 0 0, 0 10, 10 10, 10 0, 0 0 ),( 5 5, 5 6, 6 6, 6 5, 5 5)),((20 2, 22 2, 22 4, 20 4, 20 2)))' )


geometry = QgsGeometry.fromWkt( 'POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30))' )
for v in geometry.vertices():
    print(v.x(), v.y())
    
   
geometry = QgsGeometry.fromWkt( 'POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10), (20 30, 35 35, 30 20, 20 30))' )

for ndx, part in enumerate(geometry.constParts()):
	print(f"Part {ndx}")
	for v in part.vertices():
		print(v.x(), v.y())


multipolygon_with_hole = 'MULTIPOLYGON (((40 40, 20 45, 45 30, 40 40)), ((20 35, 10 30, 10 10, 30 5, 45 20, 20 35), (30 20, 20 15, 20 25, 30 20)))'

geometry = QgsGeometry.fromWkt(multipolygon_with_hole)

for ndx, part in enumerate(geometry.constParts()):
	print(f"Part {ndx}")
	
	elements = part.asGeometryCollection()
	
	endx = 0
	for elem in elements:
		print(f"Element {endx}")
		for v in elem.vertices():
			print(v.x(), v.y())
		endx += 1


