![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
iboxty
https://tyliupku.github.io/
展开
-
python 安装pip、.whl格式的文件
pip是python中的一个包管理器。 包管理器就是是在电脑中自动安装、配制、卸载和升级软件包的工具组合。pip可以代替之前的easy_install,可以十分方便的引入第三方库。和linux的Ubuntu以及Debian等的apt包管理器是一样的概念。1)pip下载在这里 2)解压之后 cd到对应文件夹下安装(先安装setuptools) 3)在系统环境变量中将..\python27\Scr原创 2015-04-19 00:13:14 · 14247 阅读 · 2 评论 -
python中文乱码的问题
在运行这样类似的代码:#!/usr/bin/env pythons="中文"print s最近经常遇到这样的问题:问题一:SyntaxError: Non-ASCII character '\xe4' in file E:\coding\python\Untitled 6.py on line 3, but no encoding declared; see h转载 2015-04-16 17:26:21 · 904 阅读 · 0 评论 -
Python集合(set)类型的操作
python的set和其他语言类似, 是一个无序不重复元素集, 基本功能包括关系测试和消除重复元素. 集合对象还支持union(联合), intersection(交), difference(差)和sysmmetric difference(对称差集)等数学运算.sets 支持 x in set, len(set),和 for x in set。作为一个无序的集合,sets不记录元素位置或者插入点转载 2015-04-12 20:55:46 · 536 阅读 · 0 评论 -
Python 列表(list)操作
创建列表sample_list = ['a',1,('a','b')]Python 列表操作sample_list = ['a','b',0,1,3]得到列表中的某一个值value_start = sample_list[0]end_value = sample_list[-1]删除列表的第一个值del sample_list[0]在列表中插入一转载 2015-04-12 20:51:36 · 518 阅读 · 0 评论 -
python中的sum函数
转自:这里我们平时用的sum应该是默认的axis=0 就是普通的相加 而当加入axis=1以后就是将一个矩阵的每一行向量相加例如:import numpy as npnp.sum([[0,1,2],[2,1,3],axis=1)结果就是:array([3,6])下面是自己的实验结果,与上面的说明有些不符:a = np.array([[0, 2, 1]])print a.sum() print a.转载 2015-04-10 09:44:46 · 2168 阅读 · 0 评论 -
Numpy扩充数组函数之repeat和tile用法
转自这里 用repeat和tile扩充数组元素,例如>>> import numpy as np>>> np.arange(10)array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])>>> a = np.arange(10)>>> aarray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])>>> a.repeat(5)array([0, 0,转载 2015-04-10 16:21:47 · 1379 阅读 · 0 评论 -
numpy中argsort函数用法
转自这里numpy中argsort函数用法,有需要的朋友可以参考下。在Python中使用help帮助>>> import numpy>>> help(numpy.argsort)Help on function argsort in module numpy.core.fromnumeric:argsort(a, axis=-1, kind=’quicksort’, order=None) Re转载 2015-04-10 10:05:27 · 11479 阅读 · 0 评论 -
python数组的使用
1、Python的数组分三种类型:(1) list 普通的链表,初始化后可以通过特定方法动态增加元素。定义方式:arr = [元素](2) Tuple 固定的数组,一旦定义后,其元素个数是不能再改变的。定义方式:arr = (元素)(2) Dictionary 词典类型, 即是Hash数组。定义方式:arr = {元素k:v}2、下面具体说明这些数组的使转载 2015-04-12 20:50:14 · 469 阅读 · 0 评论 -
python字典访问的三种方法
转自这里 定义字典 dic = {‘a’:”hello”,’b’:”how”,’c’:”you”}方法一:for key in dic: print key,dic[key] print key + str(dic[key])结果: a hello ahello c you cyou b how bhow细节:print key,dic[key],后面有个逗号,转载 2015-04-10 10:51:55 · 1331 阅读 · 0 评论