Recent Posts

Python: SpooledTemporaryFile

less than 1 minute read

The tempfile.SpooledTemporaryFile function operates exactly as TemporaryFile() does, except that data is spooled in memory until the file size exceeds the pa...

Python: Private variables

less than 1 minute read

To make Python treat a variable as pseudo-private, follow the convention of putting two underscores (i.e., __) at the beginning of the variable’s name, e.g.:

Python: Print without newline

less than 1 minute read

To print a string without appending the usual newline, use the end parameter of the print function:

Python: Flushing while printing

less than 1 minute read

Since Python 3.3, you can force the normal print() function to flush without the need to use sys.stdout.flush(); just set the flush keyword argument to Tr...