随笔分类 - Python
摘要:```python import csv import time def timestamp_to_timestr(timeStamp): timeArray = time.localtime(int(timeStamp)) otherStyleTime = time.strftime("%Y %m
阅读全文
摘要:python3 的str就是unicode,只有encode函数,调用encode返回的是bytes。 bytes只有decode函数,调用decode返回的是str。
阅读全文
摘要:```python
zh_ls = ['人','民'] print str(zh_ls).decode("string_escape")
```
阅读全文
摘要:创建工作目录 首先使用pip安装pelican和markdown 然后创建目录 ` 接着进入目录 ,执行 ,当前目录内就会生成默认配置好的文件 修改配置 pelicanconf.py是博客的配置文件: 在Makefile文件里添加upload命令,方便上传到githu...
阅读全文
摘要:"文档链接" pwiz is a little script that ships with peewee and is capable of introspecting an existing database and generating model code suitable for i...
阅读全文
摘要:```python
import os
os.urandom(24)
```
阅读全文
摘要:###矩阵初始化支持matlab语句初始化,支持narray和array初始化。```python>>> import numpy as np>>> M = np.matrix("1 2 3;4 5 6;7 8 9")>>> Mmatrix([[1, 2, 3], [4, 5, 6],...
阅读全文
摘要:*函数对全局变量赋值时,要加global声明*1.不添加globa声明,可以读取全局变量,但是不能赋值```python>>> a=1>>> def f():... a=2... print a... >>> f()2>>> a1```2.如果不提前进行global声明,对全局变量赋...
阅读全文
摘要:```python>>> A=matrix("1 2;3 4")>>> Amatrix([[1, 2], [3, 4]])>>> A[:,1]matrix([[2], [4]])>>> A[1,:]matrix([[3, 4]])>>> A[1]matrix([[3, 4...
阅读全文
摘要:列合并/扩展:**np.column_stack()**行合并/扩展:**np.row_stack()**```python>>> import numpy as np>>> a = np.arange(9).reshape(3,-1)>>> aarray([[0, 1, 2], [3,...
阅读全文
摘要:numpy模块中的矩阵对象为numpy.matrix,包括矩阵数据的处理,矩阵的计算,以及基本的统计功能,转置,可逆性等等,包括对复数的处理,均在matrix对象中。 class numpy.matrix(data,dtype,copy):返回一个矩阵,其中data为ndarray对象或者字符形式;...
阅读全文
摘要:参考资料:> [An Introduction To Tkinter](http://effbot.org/tkinterbook/tkinter-index.htm)> [Python 定时器](http://www.cnblogs.com/simayixin/archive/2011/05/31...
阅读全文
摘要:> 原文地址:http://www.niwozhi.net/demo_c65_i50946.html关于卡尔曼滤波的理论这里不打算讲了,就是那个5个基本的公式,这里直接给出公式:公式1:`X(k|k-1) = AX(k-1 | k-1) + BU(k) + W(k)`公式2:`P(k|k-1) = ...
阅读全文
摘要:在软件包里,必须添加`__init__.py`文件。想要对外公开的module必须在`__init__.py`内`import`一次,这样这些module才能被外部代码`import`并调用。
阅读全文
摘要:1. 开启演示平台-------------选择WSGI,输入应用名称,即是演示网页的网址。2. web.py代码迁移--------------将Python...
阅读全文
摘要:PyBayes [主页](https://github.com/strohel/PyBayes) [文档](http://strohel.github.io/PyBayes-doc/)-------------------------PyBayes is an object-oriented Pyt...
阅读全文
摘要:> 本文参考官方文档:http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html起步------------------------新建一个matplotlib.figure.Figure对象,然后向其添加一个Axes3D类型的axes对象。其中...
阅读全文
摘要:原文地址http://blog.csdn.net/watsy/article/details/14161201先发一下官方文档地址。http://www.crummy.com/software/BeautifulSoup/bs4/doc/建议有时间可以看一下python包的文档。Beautiful ...
阅读全文
摘要:###首先安装相关库```bashsudo apt-get install build-essential git cmake libqt4-dev libphonon-dev python2.7-dev libxml2-dev libxslt1-dev qtmobility-dev```###pi...
阅读全文

浙公网安备 33010602011771号