8. Errors and Exceptions — Python 3.15.2 documentation
In the example, the error is detected at the function print() , since a ... The problem with this code is that it leaves the file open for an ...
In the example, the error is detected at the function print() , since a ... The problem with this code is that it leaves the file open for an ...
This example, as usual, demonstrates some new Python features: The return statement returns with a value from a function. return without an expression argument returns None. Falling off the end of a function also returns None.
The following example shows how to loop through header information in a ZIP file without using the zipfile module. Pack codes "H" and "I" represent two and four byte unsigned numbers respectively. The "<" indicates that they are standard size and in little-endian byte order
For example, this listcomp combines the elements of two lists if they are ... error is raised >>> [x, x**2 for x in range(6)] File "<stdin>", line 1 [x ...
| 1. Whetting Your Appetite¶. If you do much work on computers, eventually you find that there’s some task you’d like to automate. For example, you may wish to perform a search-and-replace over a large number of text files, or rename and rearrange a bunch of photo files in a complicated way.
The optional source parameter can be used to initialize the array in a few different ways: ... This code is exactly equivalent to the first example. Be sure to ...
This module performs conversions between Python values and C structs represented as Python bytes objects. ... array of bytes implement the buffer protocol ...
Otherwise these codecs treat the presence of surrogate code point in str as an error. ... For example, the German lowercase letter 'ß' will be converted to ...