It looks like you're new here. If you want to get involved, click one of these buttons!
How can I print list of layers used in gds/oasis file?
E.g. like this (using the klayout module from PyPI.org.
To install it into your Python: Python bin directory/pip3 install klayout
import klayout.db as kl
lay = kl.Layout()
layer_map = lay.read(sys.argv)