Download the VirtualDesktopAccessor.dll from here and put it in your working directory.
Run the following code:
import ctypes
vda = ctypes.WinDLL("VirtualDesktopAccessor.dll")
num = vda.GetCurrentDesktopNumber()
print(num)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…