#!/usr/bin/python
# -*- coding: UTF-8 -*-
import os
class Log:
@staticmethod
def e(msg):
print(Log.red + '[x]:' + msg )
@staticmethod
def w(msg):
print(Log.yellow + '[!]:' + msg )
@staticmethod
def i(msg):
print(Log.green + '[+]:' + msg )
@staticmethod
def t(msg):
print(Log.blue + '[-]:' + msg )
red = '\033[1;31m'
green = '\033[1;32m'
yellow = '\033[1;33m'
blue = '\033[1;34m'
# end = '\033[00m'
#判断文件是否存在
def os_path_exists(file_path):
Log.i(file_path)
filename = r''+file_path
if os.path.exists(filename):
Log.i("file_path exists")
else:
Log.i("file_path not exists")
quit()
def os_path_isfile(file_path):
if not os.path.isfile(file_path):
Log.i(&#
python os.path常用模块(os.path.exists)
最新推荐文章于 2021-11-25 17:55:03 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)