python
lemonamaya
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Python基础 print()莫烦视频
print语句print(1) print('we are goning todo something') print("I'm Morvan") print('I\'m m') print('apple'+'car') print('apple'+'4') print('apple'+str(4)) print(1+2) print('1+2') print(int('1')+2) print(f原创 2017-06-04 19:54:20 · 261 阅读 · 0 评论 -
Python 基础 while循环
while循环condition =1 while condition<10: print(condition) condition = condition+1死循环while True: print("I'm True")原创 2017-06-04 20:12:36 · 278 阅读 · 0 评论 -
Python基础 for循环
for 循环example_list =[1,2,3,4,5,6,7,8,9,10,12,1,3] for i in example_list: print(i) print('inner of for') for windows :control+[print('outer of for')inner of for 和outer of for 是存在于for原创 2017-06-04 20:27:27 · 500 阅读 · 0 评论 -
Python基础 if条件
if条件x=1 y=2 z=3 if x>y: print('x is greater than y.') if x<y: print('x is less than y.') if x<y<z: print('x is less than y,and y is less than z.')a=2 b=2 if a==b: print('a is equal to y原创 2017-06-04 21:09:25 · 324 阅读 · 0 评论 -
Python 基础 def函数
def函数 def function(): print('This is a function.') a=1+2 print(a)function()原创 2017-06-04 21:16:07 · 834 阅读 · 0 评论 -
Python 基础 读写文件
open 打开文件,当文件不存在时会创建一个空文件 打开后要执行关闭命令,closetext = 'This is my first test.\nThis is next line\nThis is last line.' print(text)my_file = open('my file.txt','w') my_file.write(text) my_file.close()在打开的文件中原创 2017-06-05 19:51:48 · 437 阅读 · 0 评论 -
isinstance函数
转自这里写链接内容今天看了下廖雪峰的网站,发现有个isinstance函数可以对参数类型进行判断:对参数类型做检查,只允许整数和浮点数类型的参数。数据类型检查可以用内置函数isinstance实现:def my_abs(x): if not isinstance(x, (int, float)): raise TypeError('bad operand type')转载 2017-06-24 14:44:17 · 4909 阅读 · 0 评论
分享