我得到了这个2 python脚本
import serial
serial = serial.Serial("/dev/ttyUSB0", baudrate=9600)
code = ''
while True:
data = serial.read()
if data == '\r':
print(code)
code = ''
else:
code = code + data
和
import time
import datetime
import MySQLdb
localtime = time.localtime(time.time())
day = localtime.tm_wday
time = localtime.tm_hour
print day
print time
data = 'DOSEN1'
db = MySQLdb.connect("localhost", "root", "", "skripsi")
cur = db.cursor()
cond1 = "SELECT nama_dosen FROM dosen WHERE kode_dosen = '%s'" %data
cur.execute(cond1)
hitung = cur.rowcount
res1 = cur.fetchall()
for row in res1:
nama_dosen = row[0]
if hitung == 1:
res1 = nama_dosen
elif hitung != 1:
print "Dosen tidak Terdaftar"
如何加入这2个脚本,以便数据='DOSEN1'可以替换为RFID标签号?
我真的很喜欢这个编程语言,真的需要帮助。感谢
答案 0 :(得分:0)
假设indexPath.row
在第二个脚本中为您提供print(code)
的值,这样的内容应该有效:
data