摘要: 购物车程序 (一): 整体流程 拆件流程: 1.输入工资 salary=input("Input your Money")if salary.isdigit(): #判断是否为数字 salary=int(salary)else: exit("Invalid data type...")welcom_ 阅读全文
posted @ 2016-12-03 16:59 Daniel.lu 阅读(199) 评论(0) 推荐(0) 编辑
摘要: #循环语句,内容:count开始循环,一直循环。当数字到达>50 <60时显示文字,当数字到达70显示再见 count=0while True: count +=1 print(count) if count >50 and count<60: continue print("你好你好你真好") i 阅读全文
posted @ 2016-12-03 16:18 Daniel.lu 阅读(241) 评论(0) 推荐(0) 编辑
摘要: #词典用于查找记录,更为简单 #字典可以去除重复 #K,V: K是唯一的,V是可以变的。 id_db= { 310109198811212833: {'name':'Dnaiel Lu', 'age': 28, 'addr': 'Shanghai' }, #如果继续添加K,V,需要使用{},区分开 阅读全文
posted @ 2016-12-03 16:14 Daniel.lu 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 恢复内容开始 字符串r=(1,2,3,4,5) #只读列表,元祖,不可以更改,只能查 阅读全文
posted @ 2016-12-03 16:05 Daniel.lu 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 列表用于存储内容并且保存在一个变量之中如:name=["wenwen","yongyong","mama","baba","weiwei","qiuqiu","wuwu"] #列表读取顺序是从0开始,比如wenwen 等于0 、yongyong 练习: 阅读全文
posted @ 2016-12-03 15:55 Daniel.lu 阅读(330) 评论(0) 推荐(0) 编辑
摘要: 我们通常会需要在命令中,打开文件输入信息,在python中我们就会使用open语法,进行此方面的操作。详细方式如下;#Python open 函数# 作用:打开一个文件# 语法:open(file[, mode[, buffering[, encoding[, errors[, newline[, closefd=True]]]]]])# 比如1:读的形式打开 # f= open ('pat... 阅读全文
posted @ 2016-11-20 16:16 Daniel.lu 阅读(892) 评论(0) 推荐(0) 编辑
摘要: 循环语句 & 继续语句 age = 28counter =0 #自己编辑一个计数器for i in range(10): #循环语句,不能改变 print('-->counter:', counter) #显示计数器的数字的变化 if counter <3: youage = int(input(" 阅读全文
posted @ 2016-11-19 10:45 Daniel.lu 阅读(292) 评论(0) 推荐(0) 编辑
摘要: 循环语句 age = 28for i in range(10): if i < 3: #对i使用if语句 youage = int(input("输入你的年龄")) if youage==age: print("你猜对了") break #break 表示,如果答对了,此循环就结束了 elif yo 阅读全文
posted @ 2016-11-19 10:41 Daniel.lu 阅读(255) 评论(0) 推荐(0) 编辑
摘要: If 语句 user= "吹Sir"passwd= "strong"username = input ("Username:")password = input ("Password:")if username ==user and password==passwd: #<--在这里你可以使用,an 阅读全文
posted @ 2016-11-19 10:37 Daniel.lu 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 导入模块使用import 命令,如调用windows 命令; #os命令,此命令是调用windows命令import osos.system("dir")#用于打印原始输入信息os.popen("dir").read()#查询python目录import sysprint(sys.path)#win 阅读全文
posted @ 2016-11-19 10:33 Daniel.lu 阅读(251) 评论(0) 推荐(0) 编辑