Python
A289672082
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
初学python 解压手写训练图片
import numpy as npfrom matplotlib import pyplot as pltfrom PIL import Imageimport osdef load_data(path='mnist.npz'): f = np.load(path) x_train, y_train = f['x_train'], f['y_train'] x_t原创 2017-10-05 19:06:06 · 764 阅读 · 0 评论 -
文件批量重命名
import osimport shutilpath='E:\CC_NEW\CC3.1-alpha.7\验证码\'for dirpath,dirnames,filenames in os.walk(path): for file in filenames: fullpath=os.path.join(dirpath,file) print原创 2017-10-13 14:16:57 · 500 阅读 · 0 评论 -
CPython 交互操作
返回PY类型字符串PyString_FromString加载模块PyImport_ImportC++向Python传参数是以元组(tuple)的方式传过去的pArgs = PyTuple_New(1);PyTuple_SetItem(pArgs, 0, PyInt_FromLong(a));调用PY函数PyObject_CallObject获取PY属性或函数PyObject_GetAtt转载 2017-11-24 14:49:57 · 1811 阅读 · 0 评论 -
py c 内嵌通信
PyObject* IMUL(PyObject* self, PyObject* args){ int n, result; if (!PyArg_ParseTuple(args, "i:arg1", &n)) return NULL; result = n*2; return Py_BuildValue("i", result);}static原创 2017-11-24 17:01:55 · 486 阅读 · 0 评论
分享