// checkbox复选框,让其勾选时触发一个事件,取消勾选时不触发<input type="checkbox" οnclick="checkboxOnclick(this)"/><script>functioncheckboxOnclick(checkbox){if( checkbox.checked ==true){//Action for checked}else{//Action for not checked}}</script>
🍍 python
import warnings
warnings.filterwarnings("ignore")
#open文件对象的返回结果本身也可看作一个迭代器for line inopen("./test.csv",encoding="utf8"):print(line)
result = json.loads(requests.get(url).content.decode("utf-8"))["results"][0]["formatted_address"]
☕ SQL
createindex index_ip on video(IP);#SQL Server创建索引execute sp_helpindex @objname='video';#SQL Server查看索引#更新数据update 表名 setvalue=casewhen id=1then 一个值
when id=2then 一个值
when id=3then 一个值 elsevalueendwhere id in(1,2,3)
#逐条修改数据库中的记录import pymssql
conn = pymssql.connect(host='localhost', user='sa', password='123456', database='dbname')
cursor = conn.cursor()
cursor_run = conn.cursor()
cursor.execute('SELECT [ip],[lng],[lat] FROM [dbname].[dbo].[video]')
num =0for ip,lng,lat in cursor.fetchall():
num +=1
sql ="update [dbname].[dbo].[video] set ID = 500+%d where IP like '%s'"%(num,ip)
cursor_run.execute(sql)
conn.commit()
-- 使用这种方法逐条修改记录比利用python连接数据库逐条修改的方式要快很多!-- 方法:游标-- 声明变量,注意:一般@@表示系统预定义的全局变量DECLARE@ipAS NVARCHAR(20),@numASint,@lngAS NVARCHAR(20),@latAS NVARCHAR(20);-- 声明游标DECLARE C CURSORFORSELECT[IP],[longitude],[latitude]FROM[Landmarks].[dbo].[video];OPEN C;-- 取第一条记录FETCHNEXTFROM C INTO@ip,@lng,@lat;set@num=1WHILE @@FETCH_STATUS=0BEGIN-- 操作update[Landmarks].[dbo].[video]settemp=3745432+@numwhere IP like@ip;set@num=@num+1;-- print @ip;-- 取下一条记录FETCHNEXTFROM C INTO@ip,@lng,@lat;END-- 关闭游标CLOSE C;-- 释放游标DEALLOCATE C;
#open文件对象的返回结果本身也可看作一个迭代器for line in open("./test.csv",encoding="utf8"): print(line)result = json.loads(requests.get(url).content.decode("utf-8"))["results"][0]["formatted_address"]