28.10.2021 Views

Python Tutorial ( PDFDrive )

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Python Database Access ...................................................... 338

What is MySQLdb? ................................................................................ 339

How do I install the MySQLdb? .............................................................. 339

Database Connection: ............................................................................ 339

EXAMPLE: ........................................................................................... 340

Creating Database Table: ...................................................................... 340

EXAMPLE: ............................................................................................. 340

INSERT Operation: ................................................................................ 341

TUTORIALS POINT

Simply Easy Learning

EXAMPLE: ........................................................................................... 341

EXAMPLE: ........................................................................................... 342

READ Operation: ................................................................................... 342

EXAMPLE: ........................................................................................... 342

Update Operation: .................................................................................. 343

EXAMPLE: ............................................................................................. 343

DELETE Operation: ............................................................................... 344

EXAMPLE: ........................................................................................... 344

Performing Transactions: ....................................................................... 344

EXAMPLE: ............................................................................................. 344

COMMIT Operation: ............................................................................... 345

ROLLBACK Operation: .......................................................................... 345

Disconnecting Database: ....................................................................... 345

Handling Errors: ..................................................................................... 345

Python Networking ................................................................ 347

What are Sockets? ................................................................................. 347

The socket Module: ................................................................................ 348

Server Socket Methods: ......................................................................... 348

Client Socket Methods: .......................................................................... 348

General Socket Methods: ....................................................................... 348

A Simple Server: .................................................................................... 348

A Simple Client: ...................................................................................... 349

Python Internet modules ........................................................................ 349

Further Readings: .................................................................................. 350

Python Sending Email ........................................................... 351

Example: ................................................................................................ 351

Sending an HTML e-mail using Python: ................................................. 352

EXAMPLE: ........................................................................................... 352

Sending Attachments as an e-mail: ....................................................... 353

EXAMPLE: ............................................................................................. 353

Python Multithreading ............................................................ 355

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!