porter.py 文件源码

python
阅读 42 收藏 0 点赞 0 评论 0

项目:portia2code 作者: scrapinghub 项目源码 文件源码
def start_scrapy_project(project_name):
    """Bootstrap a portia project with default scrapy files."""
    if PY2:
        project_name = encode(project_name)
    files = find_files(project_name)
    out_files = {}
    for path, contents in files.items():
        contents = string.Template(contents).substitute(
            project_name=project_name,
            ProjectName=string_camelcase(project_name)
        )
        if path.endswith('.tmpl'):
            path = path[:-len('.tmpl')]
        if path.endswith('scrapy.cfg'):
            path = 'scrapy.cfg'
        out_files[path] = contents
    out_files['setup.py'] = SETUP(project_name)

    return out_files
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号