![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python编程:从入门到实践
Big_Study_Father
这个作者很懒,什么都没留下…
展开
-
python编程:从入门到实践 第六章 字典
dir={'col':'gree','point':32,'dep':32.01}#字典无序#print(dir[0]) #KeyErrorprint(dir['col'])print("the dep is "+str(dir['dep'])+'!')print("添加键值对")dir['new']=236dir['newstr']='srt'print(dir)p...原创 2019-04-10 14:36:39 · 192 阅读 · 0 评论 -
python编程:从入门到实践 第七章
message=input("This is prompt:")print(message)str="this is a str"name=input(str)print(name)unuser=['alice','brian','candace']conuser=[]while unuser: conuser.append(unuser[0]) unuser....原创 2019-04-10 15:17:18 · 217 阅读 · 0 评论 -
python编程:从入门到实践 第八章
def desc(str1,str2='six six'): #默认值参数必须置后 print(str1+" want's to out put :"+str2+"\t")desc(str1='zeus',str2='lighting') #关键字实参def getname(first,last,middle=''): return "Name:"+firs...原创 2019-04-10 16:20:40 · 148 阅读 · 0 评论 -
python编程:从入门到实践 第九章
from temp1 import *class lickdog(Dog):class head(): def __init__(self,size,dept=10): self.head_size=size self.dept=dept def desc(self): print("The head is :", self.h...原创 2019-04-10 17:32:42 · 228 阅读 · 0 评论 -
python编程:从入门到实践 第十章 文件和异常
with open('a.txt') as file: #with 在不需要文件时将其关闭 contents = file.read() print(contents.rstrip()) #当文件末尾出现空字符串时,显示出来就是一个空行#每次读取一行with open('a.txt') as file: for line in file: ...原创 2019-04-11 16:17:09 · 346 阅读 · 0 评论 -
python编程:从入门到实践 第二,三章
ame=' as d\'as 'ame=ame.lstrip() # lstrip rstrip 分别去除 首位空格print(ame.rstrip()+"aa")a=13a=str(a) # 字符串 转换a=int(a)print(a/3)# 列表元素lis=['asd','bihjhn','bbsds','asdasd','oi...原创 2019-04-09 18:50:29 · 152 阅读 · 0 评论 -
python编程:从入门到实践 第四章
for val in range(20): # range默认以0开始,n-1结束 print(val,end=" ")print()for val in range(1,20,3): #指定range单步步长 print(val ,end=" ")print()# range 创建 数字列表print("range 创建 列表")lisnum=li...原创 2019-04-09 19:50:16 · 130 阅读 · 0 评论 -
python编程:从入门到实践 第五章
for val in range(4,20): if val >9 and val < 16: print(val)# 检查元素 是否在 列表中print("检查元素 是否在 列表中 ")lis=list(range(3,10))print(lis)if 3 in lis and 1 : print("six six six !...原创 2019-04-09 20:16:25 · 217 阅读 · 0 评论