1.wp-block-code {
2 border: 0;
3 padding: 0;
4}
5
6.wp-block-code > div {
7 overflow: auto;
8}
9
10.shcb-language {
11 border: 0;
12 clip: rect(1px, 1px, 1px, 1px);
13 -webkit-clip-path: inset(50%);
14 clip-path: inset(50%);
15 height: 1px;
16 margin: -1px;
17 overflow: hidden;
18 padding: 0;
19 position: absolute;
20 width: 1px;
21 word-wrap: normal;
22 word-break: normal;
23}
24
25.hljs {
26 box-sizing: border-box;
27}
28
29.hljs.shcb-code-table {
30 display: table;
31 width: 100%;
32}
33
34.hljs.shcb-code-table > .shcb-loc {
35 color: inherit;
36 display: table-row;
37 width: 100%;
38}
39
40.hljs.shcb-code-table .shcb-loc > span {
41 display: table-cell;
42}
43
44.wp-block-code code.hljs:not(.shcb-wrap-lines) {
45 white-space: pre;
46}
47
48.wp-block-code code.hljs.shcb-wrap-lines {
49 white-space: pre-wrap;
50}
51
52.hljs.shcb-line-numbers {
53 border-spacing: 0;
54 counter-reset: line;
55}
56
57.hljs.shcb-line-numbers > .shcb-loc {
58 counter-increment: line;
59}
60
61.hljs.shcb-line-numbers .shcb-loc > span {
62 padding-left: 0.75em;
63}
64
65.hljs.shcb-line-numbers .shcb-loc::before {
66 border-right: 1px solid #ddd;
67 content: counter(line);
68 display: table-cell;
69 padding: 0 0.75em;
70 text-align: right;
71 -webkit-user-select: none;
72 -moz-user-select: none;
73 -ms-user-select: none;
74 user-select: none;
75 white-space: nowrap;
76 width: 1%;
77}
78
79
80
81 from mysql.connector import MySQLConnection, Error
82from python_mysql_dbconfig import read_db_config
83
84
85def query_with_fetchone():
86 try:
87 dbconfig = read_db_config()
88 conn = MySQLConnection(**dbconfig)
89 cursor = conn.cursor()
90 cursor.execute("SELECT * FROM books")
91
92 row = cursor.fetchone()
93
94 while row is not None:
95 print(row)
96 row = cursor.fetchone()
97
98 except Error as e:
99 print(e)
100
101 finally:
102 cursor.close()
103 conn.close()
104
105
106if __name__ == '__main__':
107 query_with_fetchone()Code language: Python (python)