Nowy lepszy trunk

Additional lines of code

1

AAA
This commit is contained in:
2024-02-02 22:35:19 +01:00
committed by migatu
parent 432abc73b9
commit f55c4ce1a7
9 changed files with 1937 additions and 92 deletions
+26
View File
@@ -0,0 +1,26 @@
"""
This Python code snippet is connecting to a MySQL database
using the `mysql.connector` library and fetching data from a table named `scimag`
Here is a breakdown of what the code is doing:
"""
import netrc
import mysql.connector
NETRC_FILE = "/home/mtuszowski/.netrc"
netrc_mod = netrc.netrc(NETRC_FILE)
REMOTE_HOST_NAME = "192.168.1.192"
authTokens = netrc_mod.authenticators(REMOTE_HOST_NAME)
mydb = mysql.connector.connect(
host=REMOTE_HOST_NAME,
user=authTokens[0],
password=authTokens[2],
database="scihubdois",
)
mycursor = mydb.cursor()
mycursor.execute("SELECT * FROM scimag WHERE Title Like 'spider%'")
for x in mycursor:
print(x)