摘要: OS模块 提供对操作系统进行调用的接口 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 os.getcwd() 获取当前工作目录,即当前python脚本工作的目录路径 os.chdir("di 阅读全文
posted @ 2018-10-22 17:06 YangM 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 1 import random 2 def v_code(): 3 code = '' 4 for i in range(5): 5 add = random.choice([random.randrange(10),chr(random.randrange(65,91))]) 6 code += str(add) 7 print(cod... 阅读全文
posted @ 2018-10-22 16:19 YangM 阅读(836) 评论(0) 推荐(0) 编辑
摘要: 用法总结如下: find pathname -options [-print -exec -ok] pathname: 查找路径-option: 主要选项如下:-name: 按照文件名称查找-perm: 按照文件权限查找-prune: 不在当前指定的路径查找。如果同时指定了-depth选项,则pru 阅读全文
posted @ 2018-07-18 11:26 YangM 阅读(1245) 评论(0) 推荐(0) 编辑
摘要: 在终端中依次执行如下两条命令 阅读全文
posted @ 2018-07-05 17:36 YangM 阅读(2214) 评论(0) 推荐(1) 编辑
摘要: #__author__:Yang #date2018/6/27 menu = { '北京':{ '房山':{ '长阳':{}, '良乡':{}, '大石河':{}, }, '丰台':{ '角门': {}, '百花': ... 阅读全文
posted @ 2018-06-28 17:46 YangM 阅读(527) 评论(0) 推荐(0) 编辑
摘要: lint=1 #第一个行值赋值为1 while lint <=9:#判断第一个行值是否小于9 temp =1#再重新把第一个列值赋值为1 while temp <=lint:#判断列值是否小于行值 print((temp),"*",(lint),"=",(temp*lint),end="\t")#行值*列值=行、列的乘积 temp +=1#列值递... 阅读全文
posted @ 2018-06-20 19:43 YangM 阅读(555) 评论(0) 推荐(0) 编辑
摘要: age = 50 while True: user_input_age = int(input("age is: ")) if user_input_age == age: print(" Yes! \n") break #终止 退出程序 #continue跳出当次循环 elif user_input_ag... 阅读全文
posted @ 2018-06-19 10:49 YangM 阅读(304) 评论(0) 推荐(0) 编辑
摘要: a=int(input("请输入一个数值")) b=int(input("请输入第二个值")) c=int(input ("请输入第三个值")) if a >b: max=a if max >c: print("max",a) else: print("max",c) else: max=b if 阅读全文
posted @ 2018-06-19 05:51 YangM 阅读(3534) 评论(0) 推荐(0) 编辑
摘要: >>>1+2 3 >>>2-1 1 >>>2*2 4 >>>2**3 #2*2*2 即为2的3次方 8 >>>7/2 2.3333333333333335 >>>7//3 # 双/符号 // 整除 ,保留整数 #% 为余数 # ** 两个* 号为平方 num % = 2 等于 num = num % 阅读全文
posted @ 2018-06-15 21:29 YangM 阅读(151) 评论(0) 推荐(0) 编辑