Python零基础
吃我老猪一钉耙
这个作者很懒,什么都没留下…
展开
-
2021-05-21
Microsoft Windows [版本 10.0.18363.592](c) 2019 Microsoft Corporation。保留所有权利。 ...原创 2021-05-21 10:32:43 · 325 阅读 · 0 评论 -
python opencv 读取图像
#!/usr/bin/env python# coding=utf-8import sysimport cv2import numpy as npnp.set_printoptions(threshold=256*128*3);#img = cv2.imread("-1_c1s1_000401_04.jpg")img = cv2.imread("00000003_02_00...原创 2019-07-09 10:42:42 · 124 阅读 · 0 评论 -
Mat matlab&python
clear all;clear;clc;a = [1,2,3];b = [3,4,5];save('AB.mat','a','b')clear all;clear;clc;load('AB.mat')# coding:UTF-8import scipy.io as sciodataFile = 'AB.mat'data = scio.loadmat(d...原创 2019-07-03 08:40:03 · 166 阅读 · 0 评论 -
conda install pytorch-cpu torchvision-cpu -c pytorch
conda install pytorch-cpu torchvision-cpu -c pytorchpip install opencv-python转载 2019-07-01 15:57:51 · 2613 阅读 · 0 评论 -
Win10+VS2015+python3.6.8源码编译安装
参考:VS2015编译python 3.6.4源码参考:解决python “No module named pip”的方法(1)修改build.batset platf=x64set conf=Release首先编译Release版本,Debug版本在使用pip安装依赖包时会报错。Debug版本可以在最后编译。(2)执行build.bat会在根目录下生成exter...原创 2019-06-06 00:05:12 · 1058 阅读 · 0 评论 -
python 元素位置索引
# -*- coding: utf-8 -*-import numpy as npm = 4n = 5a = np.zeros([m,n])for i in range(m): for j in range(n): a[i][j] = 2*i + j + i*jprint(a)index = np.argwhere(a < 2)print('\...原创 2019-04-23 14:10:46 · 754 阅读 · 0 评论 -
np.dot
# -*- coding: utf-8 -*-import numpy as npprint('矩阵a的列数 == 向量b的元素个数')print('矩阵a的第i行和b对应相乘,后求和,作为输出c的第i个输出')print('输出c的元素个数 == 矩阵a的行数')m = 3n = 6a = np.zeros([m,n])b = np.zeros(n)t =for i ...原创 2019-04-23 10:31:08 · 134 阅读 · 0 评论 -
Python中self和cls的区别和使用
#!/usr/bin/python# -*- coding: UTF-8 -*-class Animal: age = 0 weight = 0 def __init__(self, species, age, weight): self.species = species Animal.age = age Anim...原创 2019-01-27 16:15:09 · 737 阅读 · 0 评论 -
Python namedtuple使用
from collections import namedtupleSTUDENT = namedtuple("Student", ["name", "subject", "score"])stu1 = STUDENT("David", "English", "91")stu2 = STUDENT("Green", "Math&原创 2019-01-24 09:12:22 · 219 阅读 · 0 评论 -
ppp
#-*- coding: UTF-8 -*-from sklearn.datasets import load_irisimport numpy as npimport mathiris = load_iris()data = iris.datalabel=iris.targetlabel.shape=(1, 150) label=np.transpose(label) d...原创 2018-05-29 13:10:54 · 283 阅读 · 0 评论 -
python levene检验、T检验、卡方检验、F检验
# -*- coding: UTF-8 -*-import scipy.io as sioimport numpy as npfrom scipy import statsfrom sklearn.feature_selection import SelectKBest from sklearn.feature_selection import chi2 from sklearn.f...原创 2018-05-20 15:14:05 · 17898 阅读 · 2 评论 -
WIN10下 python+eclipse+jdk+PyDev(离线) 搭建java,python,C/C++开发环境
下载MinGW 64位https://sourceforge.net/projects/mingw-w64/下载python,注意是64位https://www.python.org/downloads/release/python-2714/下载JDK (Java SE Development Kit)http://www.oracle.com/technet原创 2017-12-03 07:59:36 · 712 阅读 · 0 评论 -
skimage读取图像——matplotlib显示图像
# -*- coding: UTF-8 -*- from skimage import ioimport matplotlib.pyplot as pltimg=io.imread('d:/q.png')size = img.shapeprint 'size of image', sizeplt.figure(0)plt.imshow(img)print 'Good b原创 2018-01-26 16:55:42 · 617 阅读 · 0 评论 -
Numpy中一维二维数组创建和单层双层for循环
# -*- coding: UTF-8 -*- import numpy as npa = np.array([1, 2, 3])print type(a)sizea = a.shapeprint 'sizea: ', sizeafor i in range(sizea[0]): print 'a[', i, '] =', a[i]b = np.array([[1,原创 2018-01-26 15:48:33 · 1863 阅读 · 0 评论 -
Python中range() 函数
# -*- coding: UTF-8 -*- # range(start, stop, step)v1 = range(3);print v1v2 = range(1, 5);print v2v3 = range(1, 7, 2);print v3print('Good bye')运行结果:[0, 1, 2][1, 2, 3, 4][1,原创 2018-01-26 15:02:19 · 261 阅读 · 0 评论 -
Python双层for循环
matrix0 = [[1, 2], [3, 3], [2, 1]]print 'matrix0:', matrix0matrix1 = [[1 for i in range(2)] for i in range(3)]print 'matrix1:', matrix1matrix2 = [[0 for i in range(2)] for i in range(3)]print '原创 2018-01-26 14:52:49 · 21840 阅读 · 1 评论 -
Python单层for循环
# -*- coding: UTF-8 -*- I0 = [1,2,3];I1 = [4,5,6];print 'connect I0 and I1', I0 + I1num0 = len(I0)num1 = len(I1)print 'length of I0: ', num0v1 = range(0,num0)print 'all elements of v1: ',原创 2018-01-26 10:55:04 · 292 阅读 · 0 评论