- 博客(17)
- 收藏
- 关注
转载 浅析numpy之shape
近来看machine learning in action中对numpy稍有接触,其中对于array的shape有些疑惑,翻阅查询后稍有了解,分享以交流。1、shape意思为‘形状’,在很多模块(pygame、matplotlib)都有这个函数,在numpy中用在array后顾名思义就是‘矩阵的形状’,无非就是‘行列’。2、用一个简单的例子方便理解:from numpy ...
2017-10-12 09:49:00
229
转载 pirntTable
def printTable(list_name): for i in range(len(list_name)): #第一次使用: for i in list_name:报错,i变成list中的value值,对应此项目为list,后续执行报错。 for j in range(len(list_name[i])): print...
2017-08-28 11:36:00
115
转载 Add_List2Dictionay
#TheaddToInventory()function should return a dictionary that represents the updated inventory.def addToInventory(dic_name,list_name): for i in list_name: if i in dic_name: ...
2017-08-25 23:19:00
129
转载 displayInventory
# Write a function nameddisplayInventory()that would take any possible “inventory” and display it like the following: Inventory:12 arrow42 gold coin1 rope6 torch1 daggerTotal n...
2017-08-25 23:16:00
189
转载 pinicTable
def printTable(dic_name,l_length,r_length): print('ITEM TABLE'.center(l_length+r_length,"-")) for k,v in dic_name.items(): print(str(k).ljust(l_length,'.')+str(v).rjust(r_len...
2017-08-24 13:18:00
94
转载 ticTacToe
theBoard={'top-L':' ','top-M':' ','top-R':'', 'mid-L':' ','mid-M':' ','mid-R':'', 'low-L':' ','low-M':' ','low-R':''}def printBoard(board): print(board['top-L']+'|'...
2017-08-23 17:15:00
113
转载 List
1# range()method: range(a1,a2,b):from a1 to a2,including a1,not a2,with b as the interval; range(a): from 0 to a,successive integer,contains a numbers; [a1:a...
2017-08-17 23:27:00
86
转载 while循环中的变量
num1=0num2=0while num1<=7: print(num1,end='_')# num2=0 while num2<=7: print(num2,end='-') num2+=1 num1+=1 print()num2=0在while外和内得到截然不同的运...
2017-08-10 16:39:00
1043
转载 module的引用
method1\ import module_name1,module_name2 way to use function in it: module_name1.function_name() method2\ from import module from module_name import * way to use the function i...
2017-08-10 16:32:00
135
转载 range函数
1、range()能返回一系列连续增加的整数,可以生成一个列表对象。 大多出现在for循环中,在for循环中可以作为索引使用。2、range(2) ——[0,1] range(1,3)——[1,2] range(1,7,2)——[1,3,5] range(6,-2,-2)——[6,4,2,0]转载于:https://www.cnblogs.com/auLe...
2017-08-10 10:51:00
278
转载 Python的几种循环
1\if语句:if condition 是True,执行if clause语句,并跳过后面的elif或else语句;执行一次2\while语句;只要while condition是True,就会执行while clause语句,执行完后回头再看while condition的判断值; 只要condition真就无限次执行 while clause中...
2017-08-09 22:31:00
239
转载 print函数
1\直接输出数值和字符串类型:1 print(2) 2 print('hello world')2\转载于:https://www.cnblogs.com/auLeon/p/7328009.html
2017-08-09 22:26:00
122
转载 FLOW CONTROL
A\The differences between == and = operators:1 the == operator(equal to) asks whether two values are the same as each other;2 the = operator(assignment)puts the value on the right into the va...
2017-08-09 22:22:00
86
转载 DOS下的python
1、DOS下清屏命令:cls2、DOS下输入python进入Python交互界面,此时输入的命令在Python中执行,故输入cls报错,应先CTRL+Z退出python界面3、/除 //整除 %取余 ** 幂运算4、中括号[]和大括号{}有特殊的意义,在数学运算中都用()来表示5、input接收的内容全都是字符串,用类型的强制转换转载于:https://ww...
2017-08-08 23:36:00
169
转载 Python中字符串的表示
区别于其他语言,python中字符串可以用3中方法表示,且都能被正确编译:1、'mary' 单引号括起来2、"it's a great day" 双引号括起来3、''' nice to meet you, my dear friend. ''' 三引号括起来区别:a、单引号和双引号没有什么区别,不过单引号不用按shift,打字稍微快一点。表示字符...
2017-08-08 14:09:00
279
转载 注释符的区别JAVA vs Python
JAVA中注释: // 注释一行 /*...*/ 注释若干行 /**...*/ 注释若干行,并写入Javadoc文件Python注释:# 单行注释符''' 三对单引号 '''或"""三对双引号""" 是多行注释符转载于:https://www.cnblogs.com/auLeon/p/7302256.html...
2017-08-07 23:00:00
103
转载 变量的命名规格
1、由数字、字母和下划线组成;2、不能由数字开头,不能含有特殊字符和空格;3、不能以保留字命名;4、变量的命名应该有意义;5、尽量不要使用中文;6、命名方式有驼峰式、下划线分割;7、Python变量区分大小写;转载于:https://www.cnblogs.com/auLeon/p/7301915.html...
2017-08-07 22:40:00
109
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人