def file_replace(path, patterns):
    """
    Replace one or more patterns in a file.
    """
    content = open(path).read()
    if type(patterns[0]) == str:
        patterns = patterns,
    for pattern in patterns:
        content = content.replace(pattern[0], pattern[1])
    open(path, 'w').write(content)
