Charming Python: Iterators and simple generators

Sep 1, 2001 ... The construct is generators; the keyword is yield. Generators make possible
several new, powerful, and expressive programming idioms, but are also a little
bit hard to get one's mind around at first glance. In this article ... Likewise, the new
idiom for line in file: is supported via an iterator that calls .readline() .

Python APIs: The best-kept secret of OpenStack

Jun 19, 2013 ... In addition to the REST and command-line interfaces, OpenStack exposes native
Python API bindings. Learn how to use these Python bindings ... Let's create a
Python file called, as shown in Listing 5, that extracts the login
information from the environment. Note that keystone and nova use ...

Charming Python: Generator-based state machines

Jul 1, 2002 ... Introduced in Python 2.2, simple generators may be used to simplify state
machines and to simulate coroutines. Coroutines ... For example, a text
processing tool (Txt2Html) I use reads lines from a file; each line needs to be
processed in a particular fashion, depending on which category the line belongs

Sockets programming in Python

Oct 4, 2005 ... Open a file, read each line, and print it out. for line in open('file.txt'): print line. #
Create a file and write to it. file = open("test.txt", "w"). file.write("test line\n"). file.
close(). # Create a small dictionary of names and ages and manipulate. family = {'
Megan': 13, 'Elise': 8, 'Marc': 6}. # results in 8. family['Elise'].

Easy and beautiful documentation with Sphinx

Nov 29, 2011 ... Plain text documentation is also useful for collaborators across different systems.
Plain text is one of the most portable formats currently available. Although Sphinx
is written in Python and was originally created for the Python language
documentation, it is not necessarily language-centric and in some cases ...

Using Python to create UNIX command line tools

Mar 18, 2008 ... Arguably, Python is the best language for making *NIX command line tools,
period, due to its batteries-included philosophy, and its emphasis on readable
code. Just a warning, though; these are dangerous ideas, when you find out how
easy it is to create a command line tool in Python, you might be spoiled ...

Scripting KVM with Python, Part 1: libvirt

Dec 6, 2011 ... This two-part series explores how to use Python to create scripts for managing
virtual machines using Kernel-based Virtual Machine (KVM). ... This setup makes
it extremely simple to manage multiple VMs by creating a baseline system image,
and then modifying the configuration file to suit your needs.

High-performance XML parsing in Python with lxml

Oct 28, 2008 ... While any XML library is sufficient for simple Document Object Model (DOM) or
SAX parsing of small files, developers are increasingly faced with larger ... lxml is
the first Python XML library that demonstrates high-performance characteristics
and includes native support for XPath 1.0, XSLT 1.0, custom ...

Python testing frameworks: Make your life easy with a Python testing ...

May 5, 2009 ... By learning the common idioms of these three frameworks, you will not only be
better prepared to read through other programmer's Python packages, but to
build elegant and powerful test ... Either py.test or nose will accept and run the
following few lines of code as valid tests that answer this question: ...

IBM BigFix : SHA1 Tool

UPDATED: Access the tool that supports both SHA-1 and SHA-256 from here: ... The sha1.exe application will generate
an action command that will verify the size and SHA1 checksum of a file. ...
Simply run the sha1.exe file with the argument "-r <filename>" from the command

Develop, deploy, and manage your apps in the cloud

The IBM Cloud platform has everything you need to get started.