输出电脑上所有的串口名:
import serial
import serial.tools.list_ports
from easygui import *
port_list = list(serial.tools.list_ports.comports())
if len(port_list) <= 0:
print "The Serial port can't find!"
else:
for i in list(port_list):
#print i[0] 仅仅输出端口号,像COM1、COM3、COM9
print i[1]
输出一个串口名:
# -*- codi
1