![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
Percypan
这个作者很懒,什么都没留下…
展开
-
python-networkx-graphviz
1:安装GraphViz,配置系统环境变量; 2:安装graphviz.whl; 3:安装pygraphviz.whl; 4:Enjoy!Example Code:# -*- coding: utf-8 -*-import networkx as nximport matplotlib.pyplot as pltimport graphviz import randomfrom ne原创 2018-01-14 17:13:39 · 862 阅读 · 0 评论 -
python-Sqlite3-Performance optimize
修改Sqlite3的缓存大小和日志存储模式,减少磁盘访问次数,从而优化数据库速度。Example Code:#连接数据库conn = sqlite3.connect('C:/Patent/Patent.db')#设置缓存大小和日志存储模式conn.execute("PRAGMA synchronous = OFF; ")conn.execute("PRAGMA cache_size = 400原创 2018-01-14 17:15:50 · 350 阅读 · 0 评论 -
python-Sqlite3 常用方法
创建/连接数据库conn = sqlite3.connect('C:/Patent/patent.db')conn.execute("PRAGMA synchronous = OFF;") conn.execute("PRAGMA cache_size = 40000;")conn.execute("PRAGMA journal_mode = memory;")遍历数据库中的原创 2018-01-15 14:10:29 · 1821 阅读 · 0 评论 -
networkx
构造图G = nx.DiGraph()G.add_node("a", size = 12)G.add_node("b", size = 20)G.add_node("c", size = 50)G.add_edge("a","b", weight=1)G.add_edge("b","a", weight=5)G.add_edge("a","c", weight=6)G.add_edge(原创 2018-01-15 16:50:02 · 360 阅读 · 0 评论 -
C++调用Python函数并传入传出参数
步骤包含Python.h,引入python.lib Py_Initialize()初始化,结束时调用Py_Finalize()导入sys模块,添加python脚本路径导入脚本文件,从脚本中导入函数模块构造入参,如果有三个参数就构造PyTuple_New(3)构造每一个参数,可以是C++的基本类型,也可以是Python的List类型将所有参数加入到Tuple之中函数调用,得到返回值直原创 2018-03-15 16:39:26 · 11434 阅读 · 1 评论