#智能终端部分代码
#IoT 模块接入网络代码略
while True: wt=pin1.read_analog( ) #读取扩展板 pin1 端口的温度值 gx=pin2.read_analog( ) #读取扩展板 pin2 端口的光线强度值 errno,resp = wf.get('input?wt='+str(wt)+'&gx='+str(gx), 10000) if errno == 200: display.scroll(resp) else: display.scroll(str(errno))
|
#服务器端部分代码
from flask import Flask ,render_template
app = Flask(__name__)
@app.route('/chaxun',methods=['GET','POST']) # 设置请求可以为 GET 和 POST
def cx():
conn=sqlite3.connect('mydb.db')
cursor=conn.cursor()
cursor.execute("select * from jc")
values = cursor.fetchall()
conn.commit()
cursor.close()
conn.close()
return render_template('chaxun.html',xx=values) #显示所有用户信息给浏览器
@app.route('/input',methods=['GET','POST']) # 设置请求可以为 GET 和 POST
def input(): #终端上传最新采集的温度数据
#代码略
if __name__ == '__main__':
app.run(host='192.168.10.102',port=5000) #设置服务器 IP 和端口
请回答下列问题:
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei']#用来正常显示中文标签
df=pd.read_excel("高一年级借阅表.xlsx")
for i in df.index: for j in range(9,14): s=+"月" df.at[i,'总借阅量']=df.at[i,'总借阅量']+df.at[i,s] |
data={'班级':df.班级, '借阅量':df.总借阅量,'观后感':df.观后感,'荣誉':""}
dftj=pd.DataFrame(data)
df_hz=dftj[dftj["观后感"]>=10]
df_hz=df_hz.sort_values("借阅量",ascending=False)
df_hz=______________________
df_hz['荣誉']='小书虫'
print(df_hz)
在程序中②处填写代码,正确的选项是( )(单选,填字母)。
df_g=df_hz.groupby('班级').荣誉.count()
bj="";max=0
for i in range(len(df_g)):
x=
if x>max:
max=x
bj=df_g.index[i]
print('书香班级为:'+bj+',该班共有小书虫'+str(max)+'人。')
plt.bar(df_g.index, )
plt.title('书香班级排行榜')
plt.show()
具体算法为:
⑴找到链表的中点
⑵将链表的右半段反转
⑶将链表左半段和反转后的右半段合并
⑷按顺序输出每组队员编号
小胡编写程序实现将这n人进行分组并输出每组队员编号,请在划线处填入合适的代码。
# 找到原链表的中点
def middleNode(head):
slow = fast = head
while a[fast][1] != -1 and a[a[fast][1]][1] != -1:
slow =
fast = a[a[fast][1]][1]
return slow
# 将原链表的右半段反转
def reverseList(head):
pre = -1
cur = head
while cur != -1:
nextTemp = a[cur][1]
a[cur][1] = pre
cur = nextTemp
return pre
# 将原链表的两段合并
def mergeList(h1, h2):
while h1 != -1 and h2 != -1:
h1_tmp = a[h1][1]
h2_tmp = a[h2][1]
h1 = h1_tmp
a[h2][1] = h1
h2 = h2_tmp
# 输出分组情况
def show():
head = 0
i = 0
print('分组情况:')
while head != -1:
if i % 2 == 0:
print('第', , '组:', a[head][0], '和 ', end='')
else:
print(a[head][0])
i += 1
head = a[head][1]
# 读入n人编号,并按个人篮球赛成绩降序排序后依次将编号存入a中并输出a(代码略)
mid = middleNode(0)
head1 = 0
head2 = a[mid][1]
head2 = reverseList(head2)
mergeList(head1, head2)
show()