def write_file(data, outfilename):
    if not data:
        return False
    try:
        with open(outfilename, 'w') as outfile:
            for line in data:
                if line:
                    outfile.write(line)
        return True
    except (OSError, IOError) as err:
        sys.stderr.write('An error occurred while writing {0}:\n{1}'
                         .format(outfilename, str(err)))
        return False
Submit votes via ajax
dataset/ETHPy150Open huntrar/scrape/scrape/utils.py/write_file--crossover with--dataset/ETHPy150Open codelucas/flask_reddit/flask_reddit/apis/views.py/vote_comment