码迷,mamicode.com
首页 >  
搜索关键字:os-path    ( 1357个结果
【练习】用python写一个计算文件夹总大小的程序
import os size=0 filename='输入你的文件夹绝对路径' for g in os.walk(filename): path, dir_list, name_list=g for name in name_list: abs_path=os.path.join(path,name ...
分类:编程语言   时间:2020-07-05 21:10:49    阅读次数:56
20.多端项目上线部署(2)部署后端项目NewCenter到腾讯云服务器
1.项目准备 1.在settings.py中 STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') # STATICFILES_DIRS = ( # os.path.join(BASE_DIR, 'static' ...
分类:其他好文   时间:2020-07-03 17:22:59    阅读次数:79
xlrd学习使用
安装xlrd # windows 安装 pip install xlrd # mac 安装 pip3 install xlrd 使用xlrd 1.导入xlrd import xlrd 2.打开excel # 添加文件路径 excel_path = os.path.join(os.path.dirna ...
分类:其他好文   时间:2020-07-03 10:33:38    阅读次数:85
练习17--更多文件
一 相关知识 1 exists命令: 功能:基于一个字符串里面的变量文件名来判断文件是否存在,如果存在,返回 True ;不存在,返回 False 。 注意:在脚本中使用该命令需要导入:from os.path import exists 2 cat命令 功能:用于连接文件并打印到标准输出设备上。 ...
分类:其他好文   时间:2020-07-03 09:11:31    阅读次数:64
django之图形验证码生成
1、验证码生成代码 import random import string import os.path from io import BytesIO from PIL import Image from PIL import ImageFilter from PIL.ImageDraw impor ...
分类:其他好文   时间:2020-06-30 00:54:25    阅读次数:89
os.path获取当前路径及父路径
import os pwd = os.getcwd() print("当前目录: " + pwd) father_path_method1 = os.path.dirname(pwd) print("当前目录的父目录_方式一: " + father_path_method1) separator = ...
分类:其他好文   时间:2020-06-29 11:28:09    阅读次数:136
自动化测试项目config常量
import time import os import getpass # 时间戳 times = time.strftime("%Y%m%d%H%M%S") # 项目的绝对路径 BASE_PATH = '/'.join(os.path.abspath(__file__).split("/")[: ...
分类:其他好文   时间:2020-06-27 13:23:15    阅读次数:52
Django中Logging日志配置
Django日志配置 django中的log需要在settings.py中配置 import time LOGGING_DIR = os.path.join(BASE_DIR, "logs") # LOGGING_DIR 日志文件存放目录 if not os.path.exists(LOGGING_ ...
分类:其他好文   时间:2020-06-26 20:21:31    阅读次数:55
框架健壮性优化,环境变量类,正则替换excel
项目健壮性提高 path参数化 import os # 获取项目所在的绝对路径 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # 用例模块所在的目录路径 CASE_DIR = os.path.join(B ...
分类:其他好文   时间:2020-06-26 12:42:27    阅读次数:61
Python知识点记录
#1.路径相关 ##1.1 获取目录 import os Path = os.getcwd() print('本文件所在目录:'+Path) print('所在目录的上级目录'+os.path.dirname(Path)) ##1.2 获取当前系统下的路径间隔符(用于路径拼接) os.sep imp ...
分类:编程语言   时间:2020-06-23 21:46:03    阅读次数:70
1357条   上一页 1 ... 4 5 6 7 8 ... 136 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!