UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xab in position 11126: illegal multibyte sequence
with open(embedding_file) as fp:
for line in fp.readlines():
solution:
1 | with open(embedding_file, encoding='utf-8') as fp: |
#python
将dataframe结果完整显示
1 | pd.set_option('display.max_columns',a) #a就是你要设置显示的最大列数参数 |
linux
源码安装screen
1 | https://www.jianshu.com/p/2ec36b943a02 |
生成指定范围的随机数
生成[a,b]之间的
1 | y = a + (b-a)*rand() |
python
切片
切片不会引起下标越界
1 | s="a" |
https://segmentfault.com/q/1010000011412371
list.sort()
输出None
1 | mylist = [4,5,7,1,3] |
list.sort()功能是针对列表自己内部进行排序, 不会有返回值,
二维数组
直接创建法
1 | test = [[0, 0, 0], [0, 0, 0], [0, 0, 0]] |
列表生成式法
1 | test = [[0 for i in range(m)] for j in range(n)] |
使用模块numpy创建
1 | import numpy as np |
不能用[[]×n]×m
1 | a= [[0]*3]*2 # [[0,0,0],[0,0,0]] |