Cerca
Heus ací els resultats de la cerca.
Resultats de text complet:
- 1.1 SQLite
- lite3 module, you must import it in your script: <code python>import sqlite3</code> NOTE: The sqlite3 module has been available in Python since version 2.5. ... ect'' method provided by the ''sqlite3'' module: <code python>import sqlite3 conn = sqlite3.connect('hello.db')</code> The ''connect'' method returns the database rep
- 2.1 File processing - XML files
- n XML tag must have a corresponding closing tag. <code xml><?xml version="1.0"?> <data> <book title=... r> <year>1603</year> </book> </data></code> == XML parsing (part 1) Processing XML files in ... ocument, pass it to the parse method as follows: <code python>import xml.etree.ElementTree as ET tree = ET.parse('books.xml') root = tree.getroot() </code> The ''getroot'' method returns the root element
- 3.1 The CSV module in Python
- ntacts.csv'' that stores contacts from a phone: <code csv> Name,Phone mother,222-555-101 father,222-555... -102 wife,222-555-103 mother-in-law,222-555-104 </code> In the above file, there are four contacts cons... a built-in function called ''open''. Look at the code in the editor and run it. <code python>import csv with open('contacts.csv', newline='') as csvfile:
- 4.1 Logging in Python
- ging, we need to import the appropriate module: <code python>import logging</code> In this part of the course, you'll learn how to create logs using the log... the names passed to the ''getLogger'' function. <code python> import logging logger = logging.getLogge... ecommended_logger = logging.getLogger(__name__) </code> Logger names are similar to the names of the Py
- 5.1 The configparser module
- e in our application. It's not a good idea to hardcode them directly in the code. A better solution is to use the configuration file, which will be read by the code. In Python, this is possible thanks to a module c... g it, we need to import the appropriate module: <code python>import configparser</code> However, befor