Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
network-assets-reptile
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyang
network-assets-reptile
Commits
51625cb9
Commit
51625cb9
authored
Jul 13, 2023
by
liyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:youtube 360P 每次6条
parent
c9b62377
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
data_base.py
utils/data_base.py
+10
-8
No files found.
utils/data_base.py
View file @
51625cb9
import
pymysql.cursors
def
connection_databse
():
# 连接到数据库
connection
=
pymysql
.
connect
(
host
=
'192.168.0.103'
,
user
=
'root'
,
password
=
'123456'
,
database
=
'test'
,
cursorclass
=
pymysql
.
cursors
.
DictCursor
)
# try:
# # 创建游标
# with connection.cursor() as cursor:
def
write_to_database
(
data
):
"""
将数据写入数据库。
...
...
@@ -15,13 +24,6 @@ def write_to_database(data):
- pymysql.Error: 当执行数据库操作时发生错误时会引发该异常。
"""
# 连接到数据库
connection
=
pymysql
.
connect
(
host
=
'192.168.0.103'
,
user
=
'root'
,
password
=
'123456'
,
database
=
'test'
,
cursorclass
=
pymysql
.
cursors
.
DictCursor
)
try
:
# 创建游标
with
connection
.
cursor
()
as
cursor
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment