摘要: OS模块: os.getcwd() 获取当前工作目录,即当前python脚本工作的目录路径 os.chdir("dirname") 改变当前脚本工作目录;相当于shell下cd os.curdir 返回当前目录: ('.') os.pardir 获取当前目录的父目录字符串名:('..') os.ma 阅读全文
posted @ 2021-02-27 17:34 菜鸟阿呆 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 1.random.random() #用于生成一个0到1的 随机浮点数:0<= n < 1.0 1 import random 2 a = random.random() 3 print (a) 2.random.uniform(a,b) #用于生成一个指定范围内的随机符点数,两个参数其中一个是上限 阅读全文
posted @ 2021-02-27 17:25 菜鸟阿呆 阅读(466) 评论(0) 推荐(0) 编辑
摘要: import sys,os# print(__file__) #这个是由paycharm拼接出来的路径,实际值是只有bin.py这个名字# print(os.path.abspath(__file__))#这个拿到的是bin这个执行文件的绝对路径BASE_path=os.path.dirname( 阅读全文
posted @ 2021-02-27 17:11 菜鸟阿呆 阅读(111) 评论(0) 推荐(0) 编辑