Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
pliuqx authored Feb 15, 2022
1 parent 1ebcf38 commit 7dfefa8
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
17 changes: 17 additions & 0 deletions FileSave.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# -*- coding:utf-8 -*-
# @Time : 2022/1/5 14:39
# @Author: 应无所住,何生其心
# @File : FileSave.py
# @Software : PyCharm



def save(self, data):
file = open('zz.txt', 'a+', encoding='utf-8')
file.write(telte + '\n' + str(data)) # 写入章节名字,加入换行符,写入文章正文
# file.write('\r\n') # 加入换行符
# file.write(str(data)) # 写入文章正文


if __name__ == '__main__':
pass
21 changes: 21 additions & 0 deletions MysqlSave.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding:utf-8 -*-
# @Time : 2022/1/5 14:40
# @Author: 应无所住,何生其心
# @File : MysqlSave.py
# @Software : PyCharm
import pymysql

def txt_save(datalist):
# 连接数据库
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='', charset='utf8')
# 创建游标
cursor = conn.cursor()
cursor.execute('use xs')
for i in datalist:
sql = ("insert into xhaoxu(txt) values(%s)")
cursor.execute(sql, (i))
conn.commit()
conn.close()
print(datalist)
if __name__ == '__main__':
pass
16 changes: 16 additions & 0 deletions file_save.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding:utf-8 -*-
# @Time : 2022/2/8 11:09
# @Author: 应无所住,何生其心
# @File : file_save.py
# @Software : PyCharm

def firl_save(title,data):
file.write(title + '\n' + data + '\n')
# file.close()



if __name__ == '__main__':
file = open('zz.txt', 'w+', encoding='utf-8')
firl_save(title, data)
pass

0 comments on commit 7dfefa8

Please sign in to comment.