示例#1
0
def export_corpus():
    mysql_helper = MysqlHelper('193.168.15.136', 'test', 'test', 'p**n',
                               'utf8')
    with open('data/p**n.txt', 'w', encoding='utf-8',
              errors='ignore') as fporn_write:
        result_porn = mysql_helper.exeQuery('select Content from p**n')
        for row in result_porn._rows:
            fporn_write.write('{}\n'.format(row[0]))
    with open('data/unporn.txt', 'w', encoding='utf-8') as funporn_write:
        result_unporn = mysql_helper.exeQuery('select Content from unporn')
        for row in result_unporn._rows:
            funporn_write.write('{}\n'.format(row[0]))