我需要检查import $ from 'jquery';
import 'bootstrap/dist/css/bootstrap.css';
// Bootstrap JS relies on a global varaible.
// In ES6, all imports are hoisted to the top of the file
// so if we used `import` to import Bootstrap, it would
// execute earlier than we have assigned the global
// variable. This is why we have to use CommonJS require()
// here since it doesn't have the hoisting behavior.
window.jQuery = $;
require('bootstrap');
值,然后根据给定的epf[0]
条件分配
if
即使我的SQL查询为cursor = conn.cursor()
SQL = 'SELECT USERINFO.Badgenumber,\
CHECKINOUT.CHECKTIME FROM CHECKINOUT LEFT JOIN USERINFO ON\
CHECKINOUT.USERID=USERINFO.USERID ORDER BY USERINFO.Badgenumber;'
F = open(fp,'w')
for row in cursor.execute(SQL):
epf=row.Badgenumber
epf2=epf[1:].zfill(5)
DT=str(row.CHECKTIME)
if epf[0]==9:
epf1=0
elif epf[0]== 1:
epf1=V
elif epf[0]== 2:
epf1=I
elif epf[0]== 3:
epf1=H
elif epf[0]== 4:
epf1=T
elif epf[0]== 5:
epf1=B
elif epf[0]== 6:
epf1=N
elif epf[0]== 7:
epf1=A
else:
epf1=0
提供了不同的值,它也总是为epf[0]
变量指定0
答案 0 :(得分:0)
将最后两行更改为:
else:
print("Didn't match any of those, first character is", epf[0])
epf1 = 0
然后你可以自己看看你的问题是什么。您应该检查if epf[0] == '9'
或if efp.startswith('9')
,而不是将其与值9进行比较。