mysql 数据库取出字段md5加密后形成新字段再插入
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了mysql 数据库取出字段md5加密后形成新字段再插入,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3648字,纯文字阅读大概需要6分钟。
内容图文
![mysql 数据库取出字段md5加密后形成新字段再插入](/upload/InfoBanner/zyjiaocheng/519/f0d741017d754ab394efa44219e675db.jpg)
进行修改
# -*- coding: utf-8 -*- import json import codecs import hashlib from datetime import datetime with open("permeationdomain.sql", "r",encoding= "utf-8") as f: flist = f.read() for i in flist.split("\n"): if i: everyone = i.split("VALUES") data = everyone[1][:-1] data = data.replace(‘null‘, ‘"null"‘) tupdata = eval(data) hashl = hashlib.md5() hashl.update(tupdata[0].encode("utf-8")) md5=hashl.hexdigest() listdata = list(tupdata) listdata.insert(0, md5) date = datetime.now() if listdata[4] == "null": listdata[4] = str(datetime.now()) dataall = everyone[0] + "VALUES" + str(tuple(listdata)) + ";" with codecs.open("per.sql", "a", "utf-8") as f: f.write(dataall+ "\n")
最后插入表的sql语句
INSERT INTO `permeationdomain` VALUES (‘007cfbcec99a649d9e759c66be03e305‘, ‘http://www.czdx.gov.cn/‘, ‘217001002‘, ‘superman‘, ‘2019-12-18 09:09:19‘, ‘null‘, ‘滁州市‘, ‘null‘, ‘null‘, ‘null‘, ‘null‘); INSERT INTO `permeationdomain` VALUES (‘0092ca6c575186e64ff53b477ee0d85b‘, ‘http://www.bai.gov.cn/‘, ‘217001‘, ‘superman‘, ‘2019-12-17 17:29:07‘, ‘null‘, ‘北京‘, ‘null‘, ‘null‘, ‘null‘, ‘null‘); INSERT INTO `permeationdomain` VALUES (‘00b4509e1e3cb17dd5e2db7ce82d7e42‘, ‘http://www.js.xinhuanet.com/‘, ‘051004‘, ‘guozk‘, ‘2019-12-18 14:07:34‘, ‘null‘, ‘江苏‘, ‘null‘, ‘null‘, ‘null‘, ‘null‘); INSERT INTO `permeationdomain` VALUES (‘00e17b3c96289daff5fa30967d20a4cc‘, ‘test.alog.cc‘, ‘282‘, ‘superman‘, ‘2020-01-06 08:53:30‘, ‘null‘, ‘null‘, ‘null‘, ‘null‘, ‘null‘, ‘null‘); INSERT INTO `permeationdomain` VALUES (‘00e6890bd2c99baaf5b556c6f97b2df0‘, ‘http://www.ccps.gov.cn/bmpd/jsjxxy2/‘, ‘217‘, ‘superman‘, ‘2019-12-17 16:49:23‘, ‘null‘, ‘下设部门-全国党校(行政学院)教师进修学院‘, ‘null‘, ‘null‘, ‘null‘, ‘null‘); INSERT INTO `permeationdomain` VALUES (‘00eb8b07656ea5a3c362dc8e381b6d23‘, ‘http://202.84.17.254/‘, ‘051007‘, ‘guozk‘, ‘2020-01-06 11:07:32‘, ‘null‘, ‘图片上传系统‘, ‘null‘, ‘null‘, ‘null‘, ‘null‘); INSERT INTO `permeationdomain` VALUES (‘022be146e00a5673b8b73c60a2b82e7a‘, ‘https://wp.xinhua-news.cn/ssologin/‘, ‘051007‘, ‘guozk‘, ‘2020-01-06 11:01:21‘, ‘null‘, ‘新华社云存储登陆‘, ‘null‘, ‘null‘, ‘null‘, ‘null‘); INSERT INTO `permeationdomain` VALUES (‘0292731fcab7e7004fc377d4d72a41ec‘, ‘http://www.qhswdx.com/index.jsp‘, ‘217001‘, ‘superman‘, ‘2019-12-17 17:29:07‘, ‘null‘, ‘青海‘, ‘null‘, ‘null‘, ‘null‘, ‘null‘);
mysql 数据库取出字段md5加密后形成新字段再插入
标签:with http 青海 图片上传 str data com index 部门
本文系统来源:https://www.cnblogs.com/qxh-beijing2016/p/12187357.html
内容总结
以上是互联网集市为您收集整理的mysql 数据库取出字段md5加密后形成新字段再插入全部内容,希望文章能够帮你解决mysql 数据库取出字段md5加密后形成新字段再插入所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。