python学习
aolikelili
这个作者很懒,什么都没留下…
展开
-
python numpy函数:rand&randn
numpy.random.randn(d0, d1, …, dn)是从标准正态分布中返回一个或多个样本值。 numpy.random.rand(d0, d1, …, dn)的随机样本位于[0, 1)中。 用法: import numpy as np a=np.random.randn(2,3)#产生m行n列的矩阵 print(a) 输出: ...原创 2020-02-13 11:02:02 · 648 阅读 · 0 评论 -
python numpy函数:zeros()
参数: zeros(shape,dtype=float,order='C') #返回一个给定形状和类型的用0填充的数组 1.创建一位数组 zeros(参数) 2.创建其他类型的一位数组(默认类型是浮点) 3.创建多维数组 括号里面[行数,列数],要改变类型在后面加上类型即可 ...原创 2020-02-12 19:17:05 · 599 阅读 · 0 评论 -
2_chapter10
Tuples 1.tuples are like lists 2.but tuples are immutable string and tuples are immutable 3.things not to do with tuples 4. 利用tuples直接赋值 5.dictionary的每一对,(key,value)就是一个tuples结构 如果直接打印dictionary.i...原创 2020-02-08 10:08:08 · 94 阅读 · 0 评论 -
2_chapter9
9.1 Dictionaries List像筒装薯片,像书架 Dictionary像一个大包,什么都能往里面仍,需要lable 1.创建dictionary a=dict() 2. 用{ }创建dictionary 9.2 Counting with Dictionaries 1.利用dictionaries进行数数 2.检测某个key是否在dictionary里 除了一条一条检测,也可以...原创 2020-02-07 16:41:19 · 100 阅读 · 0 评论 -
2_chapter8_list
8.1 Lists a list element can be any python object: even another list lists are mutable but strings are not the length of list:(注意C++里面用的是size) range function 8.2 Manipulating Lists Concatenating Li...原创 2020-02-07 11:19:30 · 84 阅读 · 0 评论 -
2_chapter7
7.1 files grammer open a file: \n: new line character 注:a text file has newlines at the end of each line Processing files grammer count lines 文件名.read():读出文件中有多少个字节 文件也可以用函数startswith()进行查找: 如果文件每...原创 2020-02-06 11:20:52 · 81 阅读 · 0 评论 -
2_chapter6
**Chapter 6: strings **原创 2020-02-04 16:18:52 · 135 阅读 · 0 评论 -
python learning_1
programming for everybody - python 第二章 1.一些语法 打印函数:print(x) reminder:% 9/2:在python3中输出4.5而不是4,4 是python2 power:** (4**3的意思是444) type(x):输出x的类型 float(99)和int(‘123’):将整数99转换为浮点型 input():可以从对话框中接东西进来 #:...原创 2020-02-04 11:14:46 · 110 阅读 · 0 评论 -
测验1: Python基本语法元素 (第1周)
一、单选题 1 Guido van Rossum正式对外发布Python版本的年份是:...转载 2019-07-16 14:49:34 · 323 阅读 · 0 评论