通过com端口的Python USSD

通过com端口的Python USSD,python,Python,我是python新手。我是否可以使用python通过at+cusd命令通过手机发送ussd。我可以用超级终端来做。我想使用python实现自动化。谢谢。是的。使用 >>> import serial >>> ser = serial.Serial(0) # open first serial port >>> print ser.portstr # check which port was really used >>

我是python新手。我是否可以使用python通过at+cusd命令通过手机发送ussd。我可以用超级终端来做。我想使用python实现自动化。谢谢。

是的。使用

>>> import serial
>>> ser = serial.Serial(0)  # open first serial port
>>> print ser.portstr       # check which port was really used
>>> ser.write("hello")      # write a string
>>> ser.close()             # close port