![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
Q446512799
linux、c、tuxedo、oracle、perl、python、postgres
展开
-
python中16进制数据转换字节、字符串数据丢失问题
#coding=utf-8import sysimport osimport codecsimport base64myhexstr = "5C61"print('16进制数据:' + myhexstr)mytestbytes = codecs.decode(myhexstr, "hex")print('转换后byte数据[' + str(len(mytestbytes)) +']:')print(mytestbytes)myteststr = mytestbytes.de.原创 2021-07-15 17:00:17 · 568 阅读 · 0 评论 -
pygame 简单的飞机大战
#coding:utf-8import osimport os.pathimport pygameimport timeimport sysimport randomfrom pygame.locals import *class MyFeiji(object): x = 0 y = 0 movex = 0 movey = 0 live = 1 def __init__(self,x,y): self.x = x self.y = yclass MyZida.原创 2021-07-09 10:44:44 · 65 阅读 · 0 评论 -
mac上编译openssl及使用protobuf遇到问题及解决
mac上安装软件可以通过brew install安装编译openssl报错找不到malloc.h解决方法:将报错文件中#include <malloc.h>修改为#include <sys/malloc.h>The pkg-config script could not be found or is too old”brew install pkg-configconfigure: error: Package requirements (protobuf >原创 2021-06-09 11:12:07 · 552 阅读 · 2 评论 -
java调用python
原文地址:java代码:PythonInterpreter interpreter = new PythonInterpreter(); interpreter.execfile("/home/ybf/PycharmProjects/first/1.py"); PyFunction func_third= (PyFunction)interpreter.get("third",PyFunction.class); PyObject pyobj = func_third.__call_转载 2021-06-04 16:43:37 · 72 阅读 · 0 评论 -
pykmip测试
开源路径:https://github.com/OpenKMIP创建key并加解密import sslfrom kmip.pie.client import ProxyKmipClient, enumsfrom kmip.pie import objectsclient = ProxyKmipClient( hostname='127.0.0.1', port=5696, cert='/home/nxy/PyKMIP/bin/client_cert.pem',原创 2021-05-14 15:25:49 · 543 阅读 · 0 评论 -
python和go调用c动态库兼容linux和windows方法
python调用:import platformif platform.system() == 'Windows': SDK = cdll.LoadLibrary("./libkms_enc_sdk.dll")else: SDK = cdll.LoadLibrary("libkms_enc_sdk.so")go调用:/*#cgo CFLAGS: -I./#cgo linux LDFLAGS: -L../lib -lkms_enc_sdk#cgo windows LDFLAG原创 2021-04-22 10:12:00 · 200 阅读 · 0 评论 -
OSError: [WinError 127] 找不到指定的程序
windows下使用python3调用国密改造的openssl动态库报错,使用python2都是正常的,实在挺纳闷的。后来发现是python3下的DLLs路径下也存在libssl-1_1-x64.dll和libcrypto-1_1-x64.dll库文件,将里面的文件替换为改造后的文件后运行正常。...原创 2021-01-19 10:12:50 · 8518 阅读 · 6 评论 -
python使用jinja2
模板test.html<html><head></head><body><h1>{{title}}</h1><p>My name is : {{name}}</p><p>My age is : {{age}}</p><p>My loc is : {{loc}}</p>{% for n in list %} {{n['key']}}{% en原创 2020-12-23 09:57:17 · 259 阅读 · 0 评论 -
django通过ajax将后台json数据返回到前台table中显示
def findinfo(request): return render(request,'findinfo.html')def findresult(request): id = request.GET['id'] items = [] testline = {} message = {} cursor = connection.cursor() if (id == ""): cursor.execute("SELECT id,name from tmp_info") els.原创 2020-06-28 15:29:55 · 1254 阅读 · 0 评论 -
python使用protobuf
#安装tar zxvf protobuf-python-3.5.1.tar.gzcd protobuf-3.5.1./configuremakemake checkmake install#验证protoc --version#安装python protobuf模块cd pythonpython setup.py install#编写kms_sdk.proto文件#生成kms_sdk_pb2.pyprotoc -I=./ --python_out=./ kms_.原创 2020-05-27 15:45:06 · 223 阅读 · 0 评论 -
python调用c动态库
import typesfrom ctypes import *def Sm4CbcEncrypt(source,key,iv): v = c_int(0) p_int = pointer(v) p = create_string_buffer(len(source) + 64) pconfig = addressof(p) SDK.Sm4CbcEncrypt(source,len(source),pconfig,p_int,key,iv) result = string_.原创 2020-05-21 11:51:26 · 139 阅读 · 0 评论 -
python调用c动态库
from ctypes import *library = cdll.LoadLibrary("/home/nxy/lib/libxxxxxxxx.so")library.init()library.fpeEmailEncrypt.argtypes = [c_char_p, c_char_p, c_char_p,c_char_p,c_int,c_char_p,POINTER(c_in...原创 2020-04-27 14:54:24 · 150 阅读 · 0 评论 -
考勤数据处理工具
以前是用易语言写过,后来用python改写了,但是是脚本运行模式没有界面,再用wxPython改写一遍。#coding:utf-8import osimport os.pathimport randomimport datetimeimport pymysqlimport wximport osclass MyFrame(wx.Frame): def __init...原创 2019-11-15 12:10:34 · 331 阅读 · 0 评论 -
django数据模型类
django在使用python manage.py makemigrations时报错:原因是在django2.0后,定义外键和一对一关系的时候需要加on_delete选项。需要将author = models.ForeignKey(User,related_name="blog_posts")修改为author = models.ForeignKey(Use...原创 2019-11-12 16:08:58 · 145 阅读 · 0 评论 -
django连接mysql
首先python得安装pymysql模块一、在settings文件中配置mysqlDATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', #数据库引擎 'NAME': 'mysql', #数据库名 'USER': 'root...原创 2018-06-01 11:08:41 · 228 阅读 · 0 评论