![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
文章平均质量分 75
yongfengsite
这个作者很懒,什么都没留下…
展开
-
[python 笔记1] 输入输出
1、输入 python 输入主要有input 和raw_input两个函数,这两者有什么区别呢? 运行一下代码name=input('please input somthing :') print 'What you input is : '+name ps:熟悉C++的同学都知道,在我们定义变量的时候需要在变量前定义其变量类型而在这里我们定义一个name变量,却没原创 2015-08-01 18:14:04 · 957 阅读 · 1 评论 -
[python 笔记5]文件读写
1、定义 open(filename[,mode[,buffering]]) 其中mode有: 2、读文件 1)读取整个文件 test=open('input.txt','r') print test.read() 2)按字节数读取 test=open('input.txt','r') print test.read(10) 3原创 2015-08-10 11:22:55 · 783 阅读 · 0 评论 -
[python 笔记2]列表、字符串、字典(list?string?map?)
1、列表 1)python 中的列表初始化 list=[0,1,2,3,4,5,6,7,8,9] 变量名=[,,,,],当然初始列表可以为空 ps:看到[],熟悉C++的同学不禁想到了熟悉的数组,那么python中的列表和数组之间有什么区别联系呢? 在python中我们依然可以使用下标来操作原创 2015-08-02 17:40:00 · 2086 阅读 · 0 评论 -
[python 笔记3]函数(方法?)
1、定义 python函数以关键字def标识 def test(name): print 'hello %s'%(name) name=raw_input('please input your name: ') test(name) PS:在python中代码块以缩紧的方式进行标识,所以缩进对齐的语句为一个代码块,这比像C++\j原创 2015-08-04 14:49:10 · 568 阅读 · 0 评论 -
[python 笔记4]类(面向对象?)
1、定义 __metaclass__=type class Person: def __init__(self,name,age): self.name=name self.age=age def setName(self,name): self.name=name def getName(self): return self.name def setAge(sel原创 2015-08-07 11:12:09 · 678 阅读 · 0 评论