Difference between CSS Border Collapse and Border Separate

Samual Sam
Updated on 31-Jan-2020 10:06:18

216 Views

The following image justifies the difference between collapse and separate. The separate value of the border-collapse property separates the borders of the cells:ExampleYou can try to run the following code to understand the difference between border-collapse separate and collapse value:                    table.one {             border-collapse:collapse;          }          table.two {             border-collapse:separate;          }          td.a {             border-style:dotted;             border-width:2px;             border-color:#000000;             padding: 20px;          }          td.b {             border-style:solid;             border-width:2px;             border-color:#333333;             padding:20px;          }                              Border Collapse           India           Australia                            Border Separate           India           Australia          

Send HTML Email Using Python

Mohd Mohtashim
Updated on 31-Jan-2020 10:05:04

763 Views

When you send a text message using Python, then all the content are treated as simple text. Even if you include HTML tags in a text message, it is displayed as simple text and HTML tags will not be formatted according to HTML syntax. But Python provides option to send an HTML message as actual HTML message.While sending an e-mail message, you can specify a Mime version, content type and character set to send an HTML e-mail.ExampleFollowing is the example to send HTML content as an e-mail. Try it once −#!/usr/bin/python import smtplib message = """From: From Person To: ... Read More

Database Handling Errors in Python

Mohd Mohtashim
Updated on 31-Jan-2020 10:03:40

4K+ Views

There are many sources of errors. A few examples are a syntax error in an executed SQL statement, a connection failure, or calling the fetch method for an already canceled or finished statement handle.The DB API defines a number of errors that must exist in each database module. The following table lists these exceptions.Sr.No.Exception & Description1WarningUsed for non-fatal issues. Must subclass StandardError.2ErrorBase class for errors. Must subclass StandardError.3InterfaceErrorUsed for errors in the database module, not the database itself. Must subclass Error.4DatabaseErrorUsed for errors in the database. Must subclass Error.5DataErrorSubclass of DatabaseError that refers to errors in the data.6OperationalErrorSubclass of DatabaseError ... Read More

Usage of CSS border-spacing Property

Lakshmi Srinivas
Updated on 31-Jan-2020 10:02:56

69 Views

The border-spacing specifies the width between table cells. It can take either one or two values; these should be units of length.ExampleYou can try to run the following code to set the width of table cells:                    table.one {             border-collapse:separate;             width:300px;             border-spacing:15px 40px;          }                              The border-spacing property           India           UK                

Disconnecting Database in Python

Mohd Mohtashim
Updated on 31-Jan-2020 10:02:53

6K+ Views

To disconnect Database connection, use close() method.db.close()If the connection to a database is closed by the user with the close() method, any outstanding transactions are rolled back by the DB. However, instead of depending on any of DB lower level implementation details, your application would be better off calling commit or rollback explicitly.

Commit and Rollback Operation in Python

Mohd Mohtashim
Updated on 31-Jan-2020 10:02:15

671 Views

COMMITCommit is the operation, which gives a green signal to database to finalize the changes, and after this operation, no change can be reverted back.Here is a simple example to call commit method.db.commit()ROLLBACKIf you are not satisfied with one or more of the changes and you want to revert back those changes completely, then use rollback() method.Here is a simple example to call rollback() method.db.rollback()

Perform Database Transactions Using Python

Mohd Mohtashim
Updated on 31-Jan-2020 10:01:40

1K+ Views

Transactions are a mechanism that ensures data consistency. Transactions have the following four properties −Atomicity − Either a transaction completes or nothing happens at all.Consistency − A transaction must start in a consistent state and leave the system in a consistent state.Isolation − Intermediate results of a transaction are not visible outside the current transaction.Durability − Once a transaction was committed, the effects are persistent, even after a system failure.The Python DB API 2.0 provides two methods to either commit or rollback a transaction.ExampleYou already know how to implement transactions. Here is again similar example −# Prepare SQL query to DELETE required records sql ... Read More

Usage of CSS caption-side Property

karthikeya Boyini
Updated on 31-Jan-2020 10:01:27

55 Views

The caption-side property allows you to specify where the content of a element should be placed in relationship to the table.ExampleThis property can have one of the four values top, bottom, left or right. Let us seen an example to learn how to implement caption-side property:                    caption.top {             caption-side:top          }          caption.bottom {             caption-side:bottom          }                                           Countries (Top Caption)                     India           UK           US           Australia                                         Countries (Bottom caption)                     India           UK           US           Australia                

Database Delete Operation in Python

Mohd Mohtashim
Updated on 31-Jan-2020 10:00:42

304 Views

DELETE operation is required when you want to delete some records from your database. Following is the procedure to delete all the records from EMPLOYEE where AGE is more than 20 −Example#!/usr/bin/python import MySQLdb # Open database connection db = MySQLdb.connect("localhost", "testuser", "test123", "TESTDB" ) # prepare a cursor object using cursor() method cursor = db.cursor() # Prepare SQL query to DELETE required records sql = "DELETE FROM EMPLOYEE WHERE AGE > '%d'" % (20) try:    # Execute the SQL command    cursor.execute(sql)    # Commit your changes in the database    db.commit() except:    # Rollback in case ... Read More

Usage of CSS empty-cells Property

Arjun Thakur
Updated on 31-Jan-2020 10:00:36

155 Views

The empty-cells property specifies whether the border should be shown if a cell is empty. It indicates whether a cell without any content should have a border displayed.ExampleThis property can have one of the three values show, hide or inherit.                    table.empty{             width:400px;             border-collapse:separate;             empty-cells:hide;          }          td.empty{             padding:5px;             border-style:solid;             border-width:1px;             border-color:#999999;          }                                                       Title one             Title two                                 Row Title             R1T1             R1T2                                 Row Title             R2T1                                

Advertisements