The property of Matrix 矩阵性质\begin{bmatrix}a&b&c\\\\d&e&f\end{bmatrix}{A}\times{B} \neq {B}\times{A}{E}\times{A}={A}\times{E}(E is a constant 如果E为常数)
{A}\times{({B}\times{C})}={({A}\times{B})}\times{C}
summary(总结):
The all multiplication rules are true when E is a constatnt matrix except commut...
Create array12345a = np.array([[1,2,3,4],[5,6,7,8]])print(a)'''array([[1, 2, 3, 4], [5, 6, 7, 8]])'''
ndarray.ndim: show the dimensionality of array
12a.ndim# 2
ndarray.shape: show the length of array in every direction
12a.shape# (2,4)
ndarray.size: show the size of array(the value = ...
Parse web pages using CSS by BeautifulSoup
This essay refer to BeautifulSoup 解析网页: CSS
Get the content using CSS classIn ther source pages of web writing by html, it uses CSS to decorate the web. We can use the different class of CSS and the tag in it to get the content that we want.
Demo
1234...
正则表达式(Regular Expression)
正则是一种用来匹配字符串的的工具🔧,简称RegEx,在大量的字符串中寻找出所需要的字符。e.g. 在网络爬虫中寻找出需要的关键字、关键内容;在进行数据筛选时使用。
简单匹配简单的匹配类型规则:
\d 可以匹配一个数字,\w 可以匹配一个字母或者数字:
‘00\d’ 可以匹配 ‘007’ 但无法匹配 ‘00A’;
‘\d\d\d’ 可以匹配’010’;
‘\w\w\d’ 可以匹配 ‘py3’;
. 是可以匹配任意字符的,有:
‘py.’ 可以匹配 ‘pyc’; ‘pya’; ‘pyb’ ……
要匹配的长度在正则表达式...
sets
Python also includes a data type forsets. A set is an unordered collection with no duplicate elements. Basic uses include membership testing and eliminating duplicate entries. Set objects also support mathematical operations like union, intersection, difference, and symmetric difference.
12...
Character String e.g.:1234567891011121314151617>>> str1 = 'abcdefg'>>> str1[2]'c'>>> str1[1]'b'>>> str1[-0] #the first one'a'>>> str1[-1] #the last one'g'>>> str1[1:4] #from the second to the fifth, but not contain the fifth'bcd'>>>...
The methods of Requests
requests.*
details
requests.request()
Construct a request to support the following basel methods
requests.get(url,params=None,**kwargs)
url: links; params: url中的额外参数,字典或者字节流格式,可选; **kwargs: 12个控制访问的参数,可选;
requests.head()
get the head info of HTML, to HTTP’s HEAD...
The virtualenv
First, install virtualenv on linux
1$sudo apt-get install virtualenv
Second, create a virtualenv
1$sudo virtualenv youenvname
Then, activating an environment
12$cd youenvname$source ./bin/activate
Deactivaing an environment
1$deactivate
Using conda to create an environment
Fir...
今天要了解的一个人,是埃隆·马克思(Elon Musk)在了解他之前,我们先要了解一下当下的自己
很小很小的时候的我们都喜欢看星星一个有意思的现象就是,大部分人越长大就越对周围的事物缺乏了好奇心,小时候,一个星星能琢磨一晚上,看到一个虫子都会小心翼翼的去观察,看到一只蚂蚁都要跟着它走好远好远。
我们越长大,收获了越多,与此同时,我们失去的是一些永远纯真纯粹的梦境般的好奇心,还有想象力。陪伴我们增长的除了对这个世界的理解,还有烦恼和忧愁,不开心。
但我们不是要批判什么,埋怨什么不要批判,也不要埋怨。我们失去了好奇心,失去了想象力,失去了一些我们做认为的原本美好的纯粹的东西。这无可厚非,更不...