标签:注入 exe int set 一个 har 案例 演示 结果
from pymysql import connect
def main():
	"""sql演示"""
	# 1.输入一个语句,根据id展示相应的内容
id = input("请输入查询的id")
	# 2.执行sql语句
	# 创建Connection连接
	conn = connect(host=‘localhost‘, port=3306, database=‘jing_dong‘, user=‘root‘, password=‘mysql‘, charset=‘utf8‘)
	# 获得Cursor对象
	cs1 = conn.cursor()
	# sql = """select * from goods  where id = %s;""" % id 以后sql语句 千万不要直接 使用字符串拼接
	sql = """select * from goods  where id = %s;""" #  以后sql语句 千万不要直接 使用字符串拼接
	# print(sql)
	cs1.execute(sql,(id,)) # 以后参数直接在这里进行传递
	data = cs1.fetchall()
	cs1.close()
	conn.close()
	# 3.打印结果2
	for temp in data:
		print(temp)
if __name__ == ‘__main__‘:
	main()
标签:注入 exe int set 一个 har 案例 演示 结果
原文地址:https://www.cnblogs.com/wjun0/p/11515444.html