列出指定目录下的所有文件(Python)

目录

题目描述

输入/输出描述

代码

代码走读

测试用例

1. 输入正确的目录

2. 输入合法目录,但末尾包含一个或多个"/"

3. 输入合法的路径,但是一个文件的路径,而不是目录的路径

4. 输入错误的路径

5. 输入有效路径,但该目录下没有任何子目录和文件

传送门


题目描述

输入合法路径,返回该路径下所有文件的绝对路径。所有文件的绝对路径输出保存到files文件中。保存后在控制台打印write success。要求代码对各种异常输入做出有效处理。

输入/输出描述

输入描述

输入一个表示路径的字符串:(绝对路径)

例如:/Users/liushuochen/Desktop/Python Apps/DataBin

输出描述

若输入正确的路径,则打印write success。若输入不合法的路径自行处理,但不能使程序崩溃。

代码

import os
import traceback

class PathError(Exception):
    def __init__(self, message, code):
        self.message = "PathError: " + message
        self.code = code


def check_path(path):
    """
    Check path.
    :param path: <str> Input path.
    :return: <str> path
    """
    if not os.path.exists(path):
        raise PathError("directory path url %s is not exist." %  path, 500)
    if not os.path.isdir(path):
        raise PathError("path url %s is not a directory." % path, 500)
    if path[-1] == "/":
        path = path.strip("/")
        path = "/" + path

    return path


def cd(path):
    """
    Traverse the directory and add the file path to the list.
    :param path: <str> Valid path.
    :return: <list> file_list
    """
    cd_list = os.listdir(path)
    file_list = []
    for ele in cd_list:
        temp_path = path + "/" + ele
        if os.path.isfile(temp_path):
            file_list.append(temp_path)
        else:
            pre_list = cd(temp_path)
            file_list.extend(pre_list)
    return file_list


def print_files(files):
    """
    Write path to txt file.
    :param files: <list> file list.
    :return: <None>
    """
    open("files.txt", "w").write("")
    if len(files) == 0:
        open("files.txt", "w").write("None")
        print("write success.")
        return

    with open("files.txt", "w") as txt_files:
        for file in files:
            txt_files.write(file + "\n")
    txt_files.close()
    print("write success.")
    return


# main method
path = input("Input path: ")

try:
    path = check_path(path)
    files = cd(path)
    print_files(files)
except PathError as e:
    print(e.message + " errcode " + str(e.code))
    print("errmag: \n%s" % traceback.format_exc())

代码走读

import os
import traceback

# 自定义异常类。当输入的路径不存在时抛出
class PathError(Exception):
    def __init__(self, message, code):
        self.message = "PathError: " + message
        self.code = code


def check_path(path):
    """
    Check path.
    :param path: <str> Input path.
    :return: <str> path
    """
    # 如果输入的路径不存在或不是一个目录,抛出PathError
    if not os.path.exists(path):
        raise PathError("directory path url %s is not exist." %  path, 500)
    if not os.path.isdir(path):
        raise PathError("path url %s is not a directory." % path, 500)
    # 如果用户输入的是一个有效路径,但是例如“C:music///”路径中末尾存在多个"/",去除多余的"/"符号
    if path[-1] == "/":
        path = path.strip("/")
        path = "/" + path

    return path


def cd(path):
    """
    Traverse the directory and add the file path to the list.
    :param path: <str> Valid path.
    :return: <list> file_list
    """
    # 将输入的路径下所有的子目录名和文件名存储到一个列表中
    cd_list = os.listdir(path)
    # 初始化文件路径列表,这是要最终返回的结果
    file_list = []
    # 遍历cd_list,如果是目录,就接着递归调用继续查找子目录中的文件名。如果是文件,则将文件的绝对路径添加到file_list中
    for ele in cd_list:
        temp_path = path + "/" + ele
        if os.path.isfile(temp_path):
            file_list.append(temp_path)
        else:
            pre_list = cd(temp_path)
            file_list.extend(pre_list)
    # 返回最终结果
    return file_list


def print_files(files):
    """
    Write path to txt file.
    :param files: <list> file list.
    :return: <None>
    """
    # 初始化文件files.txt。接下来要将cd()的查询结果全部写入到该文件中
    open("files.txt", "w").write("")
    # 如果cd()没有在输入的路径中找到任何文件,则在files.txt中写入None
    if len(files) == 0:
        open("files.txt", "w").write("None")
        print("write success.")
        return

    # 遍历结果列表,依次将每一个元素写入文件中
    with open("files.txt", "w") as txt_files:
        for file in files:
            txt_files.write(file + "\n")
    txt_files.close()
    # 写入文件完毕后,在控制台打印题目要求的write success
    print("write success.")
    return


# 程序开始的位置
# main method
# 输入一个路径
path = input("Input path: ")

try:
    # 调用check_path()检查路径有效性。如果无效路径会在该函数中报错并被抛出异常PathError
    path = check_path(path)
    # 调用cd()函数得到输入目录下所有文件的绝对路径(files是一个列表)
    files = cd(path)
    # 将结果列表保存到txt文件中
    print_files(files)
except PathError as e:
    # 异常处理,打印错误msg和错误码,并打印出错误堆栈,以方便用户和开发人员定位分析
    print(e.message + " errcode " + str(e.code))
    print("errmag: \n%s" % traceback.format_exc())

测试用例

1. 输入正确的目录

程序执行结果:

所有的测试用例均在Windows系统和OS X系统中测试通过。以下例子来自于OS X系统。

Input path: /Users/liushuochen/Desktop/Python Apps/DataBin
write success.

写入的txt文件:

可以看出指定目录下所有文件和目录中的所有子孙目录的文件都写入在了文件中。

/Users/liushuochen/Desktop/Python Apps/DataBin/TestCase/test_frame.py
/Users/liushuochen/Desktop/Python Apps/DataBin/TestCase/__pycache__/test_frame.cpython-36.pyc
/Users/liushuochen/Desktop/Python Apps/DataBin/TestCase/test_config/testdata.json
/Users/liushuochen/Desktop/Python Apps/DataBin/TestCase/test_arraylist.py
/Users/liushuochen/Desktop/Python Apps/DataBin/TestCase/temptest.py
/Users/liushuochen/Desktop/Python Apps/DataBin/config/create.json
/Users/liushuochen/Desktop/Python Apps/DataBin/config/databin.version
/Users/liushuochen/Desktop/Python Apps/DataBin/plugins/FusionArray/compute/__pycache__/array.cpython-36.pyc
/Users/liushuochen/Desktop/Python Apps/DataBin/plugins/FusionArray/compute/array.py
/Users/liushuochen/Desktop/Python Apps/DataBin/plugins/FusionArray/api/server.py
/Users/liushuochen/Desktop/Python Apps/DataBin/plugins/FusionArray/api/__pycache__/server.cpython-36.pyc
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/bin/pip3.6
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/bin/python3
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/bin/easy_install
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/bin/python
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/bin/pip3
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/bin/easy_install-3.6
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/bin/activate.fish
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/bin/python3.6
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/bin/pip
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/bin/activate
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/bin/activate.csh
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/pyvenv.cfg
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/easy-install.pth
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/setuptools-28.8.0-py3.6.egg
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/setuptools.pth
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/EGG-INFO/PKG-INFO
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/EGG-INFO/not-zip-safe
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/EGG-INFO/SOURCES.txt
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/EGG-INFO/entry_points.txt
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/EGG-INFO/requires.txt
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/EGG-INFO/top_level.txt
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/EGG-INFO/dependency_links.txt
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/baseparser.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/compat/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/compat/dictconfig.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/index.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/retrying.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/packaging/version.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/packaging/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/packaging/utils.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/packaging/requirements.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/packaging/_structures.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/packaging/markers.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/packaging/__about__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/packaging/_compat.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/packaging/specifiers.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/ipaddress.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/webencodings/labels.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/webencodings/mklabels.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/webencodings/x_user_defined.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/webencodings/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/webencodings/tests.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/ordereddict.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/progress/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/progress/bar.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/progress/spinner.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/progress/helpers.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/progress/counter.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/_backport/shutil.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/_backport/misc.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/_backport/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/_backport/sysconfig.cfg
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/_backport/tarfile.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/_backport/sysconfig.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/w32.exe
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/locators.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/metadata.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/version.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/compat.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/index.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/manifest.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/util.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/database.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/t32.exe
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/w64.exe
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/markers.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/resources.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/scripts.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/t64.exe
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distlib/wheel.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/colorama/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/colorama/win32.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/colorama/ansitowin32.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/colorama/ansi.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/colorama/winterm.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/colorama/initialise.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/lockfile/sqlitelockfile.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/lockfile/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/lockfile/linklockfile.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/lockfile/mkdirlockfile.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/lockfile/symlinklockfile.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/lockfile/pidlockfile.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/cachecontrol/serialize.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/cachecontrol/wrapper.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/cachecontrol/controller.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/cachecontrol/compat.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/cachecontrol/filewrapper.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/cachecontrol/heuristics.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/cachecontrol/adapter.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/cachecontrol/cache.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/cachecontrol/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/cachecontrol/_cmd.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/cachecontrol/caches/file_cache.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/cachecontrol/caches/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/cachecontrol/caches/redis_cache.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/cookies.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/auth.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/sessions.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/hooks.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/compat.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/models.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/certs.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/status_codes.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/api.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/utils.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/langhungarianmodel.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/mbcssm.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/langthaimodel.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/compat.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/langbulgarianmodel.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/euckrprober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/sjisprober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/cp949prober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/constants.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/euctwfreq.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/langhebrewmodel.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/chardistribution.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/latin1prober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/charsetprober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/gb2312prober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/mbcharsetprober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/langcyrillicmodel.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/euctwprober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/codingstatemachine.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/escprober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/universaldetector.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/utf8prober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/gb2312freq.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/mbcsgroupprober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/chardetect.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/langgreekmodel.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/eucjpprober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/jisfreq.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/escsm.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/sbcharsetprober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/big5freq.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/euckrfreq.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/big5prober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/hebrewprober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/charsetgroupprober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/sbcsgroupprober.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/chardet/jpcntx.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/filepost.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/fields.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/util/request.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/util/timeout.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/util/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/util/response.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/util/retry.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/util/url.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/util/connection.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/request.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/poolmanager.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/response.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/contrib/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/contrib/socks.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/contrib/appengine.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/contrib/ntlmpool.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/connection.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/_collections.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/packages/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/packages/six.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/exceptions.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/packages/urllib3/connectionpool.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/exceptions.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/cacert.pem
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/structures.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/requests/adapters.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/appdirs.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/filters/sanitizer.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/filters/inject_meta_charset.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/filters/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/filters/base.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/filters/alphabeticalattributes.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/filters/optionaltags.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/filters/lint.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/filters/whitespace.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treewalkers/etree_lxml.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treewalkers/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treewalkers/etree.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treewalkers/genshi.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treewalkers/base.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treewalkers/dom.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treebuilders/etree_lxml.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treebuilders/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treebuilders/etree.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treebuilders/base.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treebuilders/dom.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/_inputstream.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/_ihatexml.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/constants.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/html5parser.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/_trie/_base.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/_trie/datrie.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/_trie/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/_trie/py.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treeadapters/sax.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treeadapters/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/treeadapters/genshi.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/serializer.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/_tokenizer.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/html5lib/_utils.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/six.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/distro.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/pkg_resources/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/re-vendor.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/_vendor/pyparsing.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/cmdoptions.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/download.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/status_codes.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/utils/build.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/utils/logging.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/utils/encoding.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/utils/deprecation.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/utils/ui.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/utils/filesystem.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/utils/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/utils/appdirs.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/utils/setuptools_build.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/utils/packaging.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/utils/outdated.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/utils/hashes.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/utils/glibc.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/models/index.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/models/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/operations/check.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/operations/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/operations/freeze.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/req/req_install.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/req/req_set.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/req/req_uninstall.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/req/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/req/req_file.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/vcs/git.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/vcs/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/vcs/mercurial.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/vcs/bazaar.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/vcs/subversion.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/pep425tags.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/exceptions.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/commands/show.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/commands/list.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/commands/check.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/commands/completion.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/commands/download.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/commands/__init__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/commands/hash.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/commands/uninstall.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/commands/freeze.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/commands/search.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/commands/install.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/commands/help.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/commands/wheel.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/basecommand.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/__main__.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/locations.py
/Users/liushuochen/Desktop/Python Apps/DataBin/myapps/lib/python3.6/site-packages/pip-9.0.1-py3.6.egg/pip/wheel.py
/Users/liushuochen/Desktop/Python Apps/DataBin/utils/DataBinException.py
/Users/liushuochen/Desktop/Python Apps/DataBin/utils/version_update.py
/Users/liushuochen/Desktop/Python Apps/DataBin/utils/log.py
/Users/liushuochen/Desktop/Python Apps/DataBin/utils/resource.py
/Users/liushuochen/Desktop/Python Apps/DataBin/utils/__pycache__/resource.cpython-36.pyc
/Users/liushuochen/Desktop/Python Apps/DataBin/utils/__pycache__/log.cpython-36.pyc
/Users/liushuochen/Desktop/Python Apps/DataBin/utils/__pycache__/DataBinException.cpython-36.pyc
/Users/liushuochen/Desktop/Python Apps/DataBin/api/__pycache__/servers.cpython-36.pyc
/Users/liushuochen/Desktop/Python Apps/DataBin/api/servers.py
/Users/liushuochen/Desktop/Python Apps/DataBin/log/warn.log
/Users/liushuochen/Desktop/Python Apps/DataBin/log/vt.log
/Users/liushuochen/Desktop/Python Apps/DataBin/log/test.log
/Users/liushuochen/Desktop/Python Apps/DataBin/log/error.log
/Users/liushuochen/Desktop/Python Apps/DataBin/log/debug.log
/Users/liushuochen/Desktop/Python Apps/DataBin/log/info.log
/Users/liushuochen/Desktop/Python Apps/DataBin/doc/WARNING.txt
/Users/liushuochen/Desktop/Python Apps/DataBin/.idea/DataBin.iml
/Users/liushuochen/Desktop/Python Apps/DataBin/.idea/workspace.xml
/Users/liushuochen/Desktop/Python Apps/DataBin/.idea/modules.xml
/Users/liushuochen/Desktop/Python Apps/DataBin/.idea/dictionaries/liushuochen.xml
/Users/liushuochen/Desktop/Python Apps/DataBin/.idea/misc.xml

2. 输入合法目录,但末尾包含一个或多个"/"

程序执行结果:

Input path: /Users/liushuochen/Desktop/Python Apps/DataBin/utils//
write success.

写入的txt文件:

/Users/liushuochen/Desktop/Python Apps/DataBin/utils/DataBinException.py
/Users/liushuochen/Desktop/Python Apps/DataBin/utils/version_update.py
/Users/liushuochen/Desktop/Python Apps/DataBin/utils/log.py
/Users/liushuochen/Desktop/Python Apps/DataBin/utils/resource.py
/Users/liushuochen/Desktop/Python Apps/DataBin/utils/__pycache__/resource.cpython-36.pyc
/Users/liushuochen/Desktop/Python Apps/DataBin/utils/__pycache__/log.cpython-36.pyc
/Users/liushuochen/Desktop/Python Apps/DataBin/utils/__pycache__/DataBinException.cpython-36.pyc

可以看出check_path()函数可以检测到这是一个合法有效的目录,去掉了末尾多余的“/”

3. 输入合法的路径,但是一个文件的路径,而不是目录的路径

执行程序:

可以看到当输入的是一个存在的文件路径时,代码会检测到并打印错误原因(输入的不是一个目录路径),并打印出错误码(500)和堆栈信息。

Input path: /Users/liushuochen/Desktop/Python Apps/untitled_test/files.txt
PathError: path url /Users/liushuochen/Desktop/Python Apps/untitled_test/files.txt is not a directory. errcode 500
errmag: 
Traceback (most recent call last):
  File "/Users/liushuochen/Desktop/Python Apps/untitled_test/everything_search.py", line 73, in <module>
    path = check_path(path)
  File "/Users/liushuochen/Desktop/Python Apps/untitled_test/everything_search.py", line 24, in check_path
    raise PathError("path url %s is not a directory." % path, 500)
PathError: ('path url /Users/liushuochen/Desktop/Python Apps/untitled_test/files.txt is not a directory.', 500)

此时files文件中没有任何写入。

4. 输入错误的路径

执行代码:

当输入一个不存在的路径时,代码会给出错误原因(路径不存在)和错误码(500),并打印错误堆栈。

Input path: C:/code/FusionStorage
PathError: directory path url C:/code/FusionStorage is not exist. errcode 500
errmag: 
Traceback (most recent call last):
  File "/Users/liushuochen/Desktop/Python Apps/untitled_test/everything_search.py", line 73, in <module>
    path = check_path(path)
  File "/Users/liushuochen/Desktop/Python Apps/untitled_test/everything_search.py", line 22, in check_path
    raise PathError("directory path url %s is not exist." %  path, 500)
PathError: ('directory path url C:/code/FusionStorage is not exist.', 500)

此时files文件没有写入任何信息。

5. 输入有效路径,但该目录下没有任何子目录和文件

执行代码

Input path: /Users/liushuochen/Desktop/Python Apps/untitled_test/empty
write success.

files.txt文件

None

传送门

1. input()函数

Python input函数_TCatTime的博客-CSDN博客

2. strip()函数

Python str strip方法_TCatTime的博客-CSDN博客_python中str.strip

3. append()函数

Python list append方法_TCatTime的博客-CSDN博客

4. len()函数

Python len函数_TCatTime的博客-CSDN博客

5. print()函数

Python print函数:将内容打印到标准输出_TCatTime的博客-CSDN博客

6. str()函数

Python str函数_TCatTime的博客-CSDN博客_python str函数

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值