git_issue/test.py

62 lines
1.7 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*
import re
import pymysql
import dao
import helper
import nltk
# a = dao.get_info_by_id(14044309).fetchone()
# str = a[0]+".\n"+a[1]
# # str = '```asdf```asdf'
# # print(str)
# print('='*80)
# # p = re.compile(r'`{3,}.*?`{3,}')
# # print(p.findall(str))
# # print p.sub(r'',str)
#
# import re
#
# def repl(m):
# return ' '
#
# s = str
# # s = '1\n```\n2\n```'
# s = '1\n```\n2\n```\n3```\n4```\n'
# print
#
# a= '2'
# print('start')
# print(repr(helper.filter_str(a)))
# print('end')
# a = 'DHE-RSA-AES-SHA\r\n\r\nHowever, I would like to avoid using SHA, and when I include the following directive in the SSLCipherSuite :!SHA the Android-ownCloud stops working.\r\n\r\nThis is a paid app and the new ciphers have been implemented in the Windows '
# tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
# sentences = tokenizer.tokenize(a)
# print(sentences)
#
# import re
# temp = "1/ 2/3/ 4Q5.6.7 \r\n 8\r\n 。?9.1-0。11 ,"
# temp = temp.decode("utf8")
# string = re.sub("[\s+\/_$%^*\-(+\"\']+|[:+——!,。?、~@#¥%……&*]+".decode("utf8"), " ".decode("utf8"),temp)
# # string = ' '.join(string.split())
# print string
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='123456', db='qqqq')
def get_data():
cur = conn.cursor()
sql = "select p_name,id from apache"
cur.execute(sql)
return cur
apaches = get_data()
for project in apaches.fetchall():
id = project[1]
name = project[0]
temp_name = name.split('-')[0]
cur = conn.cursor()
up_sql = "update apache set deal = " + repr(temp_name) + " where id = " + repr(id)
cur.execute(up_sql)
conn.commit()
# print temp.split('-')[0]