码迷,mamicode.com
首页 >  
搜索关键字:os-path    ( 1357个结果
Jenkins运行python脚本出现 configparser.NoSectionError: No section: 'XXXXXX'
原来的代码如下: def get_test_config(tag, key, config="config.ini"): cf = configparser.ConfigParser() cf_path = os.getcwd() cf_path = os.path.join(cf_path, co ...
分类:编程语言   时间:2019-12-16 11:34:17    阅读次数:154
[Python3] 030 常用模块 os
1. os.getcwd();2. os.chdir();3. os.listdir();4. os.makedir();5. os.system();6. os.getenv();7. os 的一些值;8. os.path ...
分类:编程语言   时间:2019-12-14 21:19:58    阅读次数:106
python,socket通信编程,文件上传例子
写一个file_receive.py和一个file_send.py程序,由file_send.py上传一个文件,file_receive.py接收上传的文件,写到指定的包内 #file_receive.pyimport socket,subprocess,os BASE_DIR = os.path. ...
分类:编程语言   时间:2019-12-13 13:48:57    阅读次数:93
python路径操作
路径操作模块 3.4版本之前 os.path模块 from os import path p = path.join("/xpc","sysconfig","network")#构建一个目录,它和存在不存在是两回事。 print(type(p),p) print(path.exists(p)) pr ...
分类:编程语言   时间:2019-12-12 23:34:58    阅读次数:180
python3 获取当前路径及os.path.dirname的使用
方法一: import sys,os os.getcwd()#然后就可以看见结果了 方法二: import os os.path.dirname(os.path.realpath('__file__'))#注意:添加单引号 python中的os.path.dirname(__file__)的使用 ( ...
分类:编程语言   时间:2019-12-12 13:31:41    阅读次数:122
软件开发目录规范
'''bin 存放一些执行文件,整个程序的入口写在这里 可执行文件 启动文件conf 配置文件lib 库 网上下载的 或者自己写的模块和包core 整个程序的核心逻辑log 日志db 数据库相关的readme 介绍软件怎么使用'''# import sys,os# os.path.abspath(_ ...
分类:其他好文   时间:2019-12-11 21:41:01    阅读次数:65
读取ini文件的方法
config = configparser.ConfigParser() config_path = os.path.join(path, 'Config/config.ini') config.read(config_path, encoding="utf-8-sig") switch = con ...
分类:其他好文   时间:2019-12-11 17:39:39    阅读次数:85
路径path知识点
1. 获取当前文件的路径 test.py os.path.abspath(path) # 返回当前文件运行的绝对路径 print("程序的绝对路径是",os.path.abspath(__file__)) # __file__就是当这个文件的绝对路径, 结果:程序的绝对路径是 F:\python高级 ...
分类:其他好文   时间:2019-12-09 21:32:21    阅读次数:126
多线程启动selenium,报NameError: name '__file__' is not defined
将__file__加上单引号就解决了: # 获取当前文件名,用于创建模型及结果文件的目录 file_name = os.path.basename('__file__').split('.')[0] 参考网址:https://blog.csdn.net/m0_37544464/article/det ...
分类:编程语言   时间:2019-12-09 18:50:49    阅读次数:77
pathlib
发现了遍历文件夹下文件更简单的方法库了,激动。 你就看看代码相比os模块有多简单: root = Path("./try—_python") new_dir = root/Path("test") # 这句话相当于 new_dir = os.path.join(root, 'test') print ...
分类:其他好文   时间:2019-12-08 23:01:06    阅读次数:181
1357条   上一页 1 ... 16 17 18 19 20 ... 136 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!