11 2016 档案

摘要:我们通常会需要在命令中,打开文件输入信息,在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 阅读(929) 评论(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 阅读(299) 评论(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 阅读(259) 评论(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 阅读(254) 评论(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 阅读(268) 评论(0) 推荐(0)
摘要:这周已经开始Python的学习了,感觉Python类似于Powershell, 但又有不同点。在此总结一下新学到的资料; 简单的使用变量的方法: 阅读全文
posted @ 2016-11-19 10:29 Daniel.lu 阅读(238) 评论(0) 推荐(0)