Python Programming for Raspberry Pi, Sams Teach Yourself in 24 Hours
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = socket.gethostbyname('localhost') port = 5150 s.connect((host, port ...
Running the Client/Server Demo To run the client/server demo programs, you need to have two separate command-line sessions open. ...
to parse data from webpages. After that, you took a look at the client/server programming paradigm and how to use the Python soc ...
Hour 21. Using Databases in Your Programming What You’ll Learn in This Hour: How to use a MySQL database server in your Python s ...
queries you for a password for the MySQL root user account. The MySQL server maintains its own set of user accounts and password ...
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> CREATE DATABASE pytest; Query OK, 1 row ...
This is quite a long command. Let’s walk through the pieces to see what it’s doing. The first section defines the privileges the ...
records, and tables. A data field is a single piece of information, such as an employee’s last name or a salary. A record is a c ...
The empid data field definition also specifies a data constraint. A data constraint restricts what type of data you can enter to ...
If all goes well, you shouldn’t get any error messages about a missing module when you run the import statement. Now you’re read ...
2: 3: import mysql.connector 4: conn = mysql.connector.connect(user='test', password='test', database='pytest') 5: cursor = conn ...
Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with - ...
12: conn.close() When you write the for loop, you must specify a variable for each data field that you return in the SELECT stat ...
on the Linux system; you don’t have to worry about a whole separate set of user accounts. Another major difference between MySQL ...
name. This is a great reminder when you’re ready to create your database objects: You can easily tell where you are in the syste ...
For simple Python scripting, you most likely won’t need to worry about creating group roles, and you can just assign privileges ...
pi@raspberrypi ~ $ psql pytest psql (9.1.9) Type "help" for help. pytest=> \dt List of relations Schema | Name | Type | Owner ...
>>> You may have noticed that the connect() method only specifies the database name. By default, it logs in to the Post ...
pi@raspberrypi ~ $ psql pytest psql (9.1.9) Type "help" for help. pytest=> select * from employees; empid | lastname | firstn ...
Summary This hour you learned how to incorporate open-source databases in your Python scripts. The Raspberry Pi supports both th ...
«
15
16
17
18
19
20
21
22
23
24
»
Free download pdf