1.注册twilio.com(或者其他sms gateway)
2.在dashborad面板上得到accountSID&authToken&twilioNumber
3.pip install twilio
4.code:

accountSID = ''
authToken=''
myNumber=''
twilioNumber=''
from twilio.rest import Client
def textmyself(mes):
    twilioCli = TwilioRestClient(accountSID,authToken)
    twilioCli.messages.create(body=message,from=twilioNumber,to=myNumber)