try this code
import serial.tools.list_ports
for i in serial.tools.list_ports.comports():
print(i)
it returns
COM1 - Port de communication (COM1)
COM5 - USB-SERIAL CH340 (COM5)
if you just wont the name of the port for exemple COM1
import serial.tools.list_ports
for i in serial.tools.list_ports.comports():
print(str(i).split(" ")[0])
it returns
COM1
COM5
as in my case py 3.7 64bits