import serial test = serial.Serial("COM1",115200)#这里就已经打开了串口 print(test.portstr) test.write(\'hello world\'.encode("utf-8") test.close() 相关文章: