PYTHON
Python Class
Anatomy A python class is defined using the 'class' keyword followed by the class name and a colon. Instance variables and methods will
Parsing JSON with Python
Using the json Library The loads method in the json library returns a dictionary for anything in curly brackets and a list for
Parsing XML with Python
Using the ElementTree library in Module xml Example 1: Selecting elements with findall import xml.etree.ElementTree as ET input = '''<stuff> <users> <user x="x1">
Python HTTP
Using Sockets The following is similar to a telnet session, where we first connect to the server, we submit a GET request, and
Regular Expressions
To use regular expressions, import re. Use re.search() to see if a string matches a regular expression. Use re.findall() to extract strings that
Tuple
A tuple is an immutable list of values. Iteration and indexes work the same way as lists, but they cannot be modified. While
Dictionary
A dictionary is a collection that stores data in key/value pairs and is equivalent to a java map. Keys can be of any
Lists
A list is an ordered collection that can contain elements of any different type, including other lists. Iteration on a list can be
Text Files
This entry provides code to read text files in python. The open function returns a handle that can be treated as a sequence
Python Strings
A string is an inmutable sequence of characters. This post covers string operations, including iteration, slicing, concatenation, comparison, string methods, and functions.