摘要: 1、open&argument 1 my_file = open("output.txt", "w") hint:You can open files in write-only mode ("w"), read-only mode ("r"), readandwrite mode ("r+"... 阅读全文
posted @ 2014-11-21 00:19 andrew.elec90 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 1、空class,占空间1 class Animal(object):2 pass 2、定义__init__()空1 class Animal(object):2 def __init__():3 pass 3、declare nameclass Animal... 阅读全文
posted @ 2014-11-20 21:19 andrew.elec90 阅读(196) 评论(0) 推荐(0) 编辑
摘要: python中使用二进制也很方便 1、表示1 one = 0b12 two = 0b103 three = 0b11 2、操作1 print 5 >> 4 # Right Shift2 print 5 << 1 # Left Shift3 print 8 & 5 # Bitwise ... 阅读全文
posted @ 2014-11-20 17:59 andrew.elec90 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 1、item1 my_dict ={'a':1,'b':2}2 print my_dict.items()3 4 [('a', 1), ('b', 2)] 2、keys,values1 my_dict ={'a':1,'b':2}2 print my_dict.keys()3 print my... 阅读全文
posted @ 2014-11-20 17:30 andrew.elec90 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 转义字符\from datetime import datetimenow = datetime.now()now.year(day,month,hour,minute,second)notis evaluated first;andis evaluated next;oris evaluated ... 阅读全文
posted @ 2014-11-19 18:03 andrew.elec90 阅读(135) 评论(0) 推荐(0) 编辑
摘要: python34 中绘图基本是matplotlib库,基于matplotlib库可以绘制基本的图形。 1、基本绘图 (1)点图(data:http://pan.baidu.com/s/1i3L0UDB) 1 import matplotlib.pyplot as plt 2 import m... 阅读全文
posted @ 2014-11-19 14:38 andrew.elec90 阅读(157) 评论(0) 推荐(0) 编辑
摘要: matplotlib,numpy,scipy是做数据挖掘的基本python库,在安装时我碰到了不少麻烦,尤其是在python 3.4中。 按照如下顺序安装1,2,3,import matplotlib库出现问题时依次安装4,5,6可以解决问题。1、numpy-1.8.1-win32-super... 阅读全文
posted @ 2014-11-19 14:12 andrew.elec90 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 内置对象包括数字(123,1.2)、字符串(‘aaa’)、列表([])、字典({'a':'b','c':'d'})、元组(())、文件(fid=open(‘’,‘r’))、集合(set(‘abc’))、BOOL量等。 1、字符串 (1)字符串索引从0开始,正向索引从左边开始,反向索引从右边开... 阅读全文
posted @ 2014-11-15 22:06 andrew.elec90 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 最近因为学习Bag of Visterms,发现很多算法国外都用python编写,所以开始学习python。对于一个没基础的人来说,学习哪个版本的python,貌似知乎上也没一个好的说法,索性学习python 3,正好从华章拿了一本learning python,恰好有2和3的区别,可以更好的学习... 阅读全文
posted @ 2014-11-15 17:05 andrew.elec90 阅读(231) 评论(0) 推荐(0) 编辑