Source

woocode / py / crawler / crawler / utils.py

Full commit
import os
from urlparse import urlparse


def writefile(fn, content):
    with open(fn, 'wb') as fb:
        fb.write(content)

def mkdir(path):
    if not os.path.exists(path):
        os.makedirs(path)

def get_pathname_from_url(url):
    u = urlparse(url)
    fn = '/'.join([u.netloc, u.path])
    #mkdir(os.path.dirname(fn))
    return fn