随笔分类 -  python

摘要:矩阵转换 1 #!/usr/local/bin/python3 2 3 # 通用 4 def transpose_irregular(matrix_s): 5 print('原矩阵为:',matrix_s) 6 matrix_d = [[0 for col in range(len(matrix_s 阅读全文
posted @ 2019-02-15 11:29 Ray_chen 阅读(360) 评论(0) 推荐(0)
摘要:安装pip [root@room9pc01 ~]# pip3 install virtualenvwrapper [root@room9pc01 ~]# find / -name virtualenvwrapper.sh export WORKON_HOME=/software/venvsource 阅读全文
posted @ 2019-01-17 19:46 Ray_chen 阅读(348) 评论(0) 推荐(0)
摘要:Linux下Git和GitHub环境的搭建 1.创建Github帐号 (name@server.com) 2.安装git 3.生成ssh key,复制公钥 4.登陆github setting-->ssh and gpg keys-->new ssh key-->粘贴公钥 5.测试ssh key是否 阅读全文
posted @ 2018-08-21 20:38 Ray_chen 阅读(1644) 评论(1) 推荐(0)
摘要:1.jieba的基本使用 1 import jieba 2 3 4 s1 = '我喜欢广州小蛮腰' 5 s2 = "我喜欢上海东方明珠" 6 #jieba,cut()#默认精准模式 7 print(10*'-','全模式',10*'-') 8 r1 = jieba.cut(s1,cut_all=Tr 阅读全文
posted @ 2018-07-27 13:28 Ray_chen 阅读(1149) 评论(0) 推荐(0)
摘要:冒泡 插入 选择 阅读全文
posted @ 2018-07-27 11:36 Ray_chen 阅读(143) 评论(0) 推荐(0)
摘要:mongo 1 """ 2 使用pymongo库操作MongoDB数据库 3 """ 4 import pymongo 5 6 # 1.连接数据库服务器,获取客户端对象 7 mongo_client=pymongo.MongoClient('localhost',27017) 8 9 # 2.获取数 阅读全文
posted @ 2018-07-27 11:33 Ray_chen 阅读(244) 评论(0) 推荐(0)
摘要:list 1 # @Auther : chen 2 # @Time : 2018/4/26 19:55 3 # @File : list_ex.py 4 # @SoftWare : PyCharm 5 6 # list1 = [1,2,3,4,5,6,7,8,9,0] 7 # random.shuf 阅读全文
posted @ 2018-07-27 11:23 Ray_chen 阅读(212) 评论(0) 推荐(0)
摘要:#操作2003excel import xlwt,xlrd #操作2007excel import openpyxl def write_excel_03(path,file_name,values): wb = xlwt.Workbook() #新建一个excel sheet = wb.add_sheet(file_name)#创建一个sheet页 row = 0#... 阅读全文
posted @ 2018-05-08 19:36 Ray_chen
摘要:#map函数--处理可迭代序列的每一个元素,得到一个可迭代序列,不改变原序列的长度和结构 num_l = [1,2,3,4,5,6,7,8,9] result = map(lambda x:x**2,num_l)#(函数,可迭代对象) print(list(result)) msg = 'abcdefg' result = map(lambda x:x.upper(),msg) print(li... 阅读全文
posted @ 2018-05-06 21:30 Ray_chen
摘要:from matplotlib import pylabfrom numpy import random#生成随机数# data = random.random_integers(1,100,50)#(最大值,最小值,数据个数)随机生成50个1-100之间的整数# print(data)#生成具有正 阅读全文
posted @ 2018-05-06 10:46 Ray_chen
摘要:import numpy as np array = np.array([[1,2,3],[2,3,4]]) a = np.random.rand(2,3) # 生成指定维度的随机多维数组 print(a) print(array) print(array.ndim) # 维度个数 print(ar 阅读全文
posted @ 2018-05-06 10:43 Ray_chen
摘要:1.安装numpy+mkl,scipy 》在shell中输入以下代码: import pip print(pip.pep425tags.get_supported()) 》确认支持的版本如win32,然后去https://www.lfd.uci.edu/~gohlke/pythonlibs下载对应的 阅读全文
posted @ 2018-05-05 18:48 Ray_chen