1
我想讓自動出席我的android手機[這是由NFC觸發]。合併Python和Android SL4A代碼
from datetime import datetime
s1 = '09:40:00'
s2 = datetime.now().strftime('%H:%M:%S')
s3 = datetime.now().strftime('%I:%M:%S %p')
FMT = '%H:%M:%S'
tdelta = datetime.strptime(s2, FMT) - datetime.strptime(s1, FMT)
print ('I have arrived ['+str(tdelta)+']' 'HH:MM:SS'' late at ['+str(s3)+'].')
並分別以下的Android代碼:
droid = android.Android
import android
number = "mycellnumber"
message = "Hello"
droid.smsSend(number, message.encode("utf-8"))
我想是合併這兩個代碼發送以下內容作爲消息(和電子郵件,我已經在電腦上分別測試了以下Python代碼後來身體):
('I have arrived ['+str(tdelta)+']' 'HH:MM:SS'' late at ['+str(s3)+'].')