From 4e120999ca13917a931899e4fce1e13ddb229107 Mon Sep 17 00:00:00 2001 From: CX-UI Date: Fri, 18 Nov 2016 10:16:11 +0800 Subject: [PATCH] Create financial --- financial | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 financial diff --git a/financial b/financial new file mode 100644 index 0000000..e49037a --- /dev/null +++ b/financial @@ -0,0 +1,112 @@ +# -*- coding:utf-8 -*- +import os, sys, datetime,io +import MySQLdb +import pandas +import urllib +import re + + +def insertMysql(username, password, filename, localdir): + conn = MySQLdb.Connect(host='localhost', user=username, passwd=password, db='Financial', charset='utf8', use_unicode= True) + #conn.set_character_set('utf-8') + cursor = conn.cursor() + txtfile = localdir + #cursor.execute("""create database if not exists Financial""") + # conn.select_db('Financial') + # cursor.execute('SET CHARACTER SET utf8') + # cursor.execute('SET character_set_connection=utf8') + # cursor.execute('alter database name character set utf8') + read_file = open(txtfile, 'rU') + f = open(txtfile) + judgeholiday = f.readline().decode('gbk').strip() + if judgeholiday == '