-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |