Python Utilities - Educational Materials In this section, we look at a few of Python's many standard utility modules to solve common problems. File System -- os, os.path, shutil The *os* and *os.path* modules include many functions to interact with the file system. The *shutil* module can copy files. os module docs filenames = os.listdir(dir) -- list of filenames in that directory path (not including . and ..).
Python Introduction - Google's Python Class - Google Code Python is a dynamic, interpreted language. Source code does not declare the types of variables or parameters or methods. This makes the code short and flexible, and you lose the compile-time type checking in the source code. Python tracks the types of all values at runtime and flags code that does not make sense as it runs. (todo: link here to the companion video segment for this section) An excellent way to see how Python code works is to run the Python interpreter and type code right into it.
s Python Class - Google's Python Class - Google Code Welcome to Google's Python Class -- this is a free class for people with a little bit of programming experience who want to learn Python. The class includes written materials, lecture videos, and lots of code exercises to practice Python coding. These materials are used within Google to introduce Python to people who have just a little programming experience. The first exercises work on basic Python concepts like strings and lists, building up to the later exercises which are full programs dealing with text files, processes, and http connections. The class is geared for people who have a little bit of programming experience in some language, enough to know what a "variable" or "if statement" is.
PYTHON This is the third post in the article series “Playing With Python And Gmail”. This will be a tutorial on how to send mails using Python smtplib through Gmail SMTP. The smtplib module defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon. [vinod@mercury ~]$ python Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import smtplib The first step is to create a SMTP connection to the server. The smtplib.SMTP class encapsulates an SMTP connection.
s Python Class - Google's Python Class - Google Code Welcome to Google's Python Class -- this is a free class for people with a little bit of programming experience who want to learn Python. The class includes written materials, lecture videos, and lots of code exercises to practice Python coding. These materials are used within Google to introduce Python to people who have just a little programming experience. Python Regular Expressions - Educational Materials Regular expressions are a powerful language for matching text patterns. This page gives a basic introduction to regular expressions themselves sufficient for our Python exercises and shows how regular expressions work in Python. The Python "re" module provides regular expression support. In Python a regular expression search is typically written as:
Hands-On Python A Tutorial Introduction for Beginners Hands-On Python A Tutorial Introduction for Beginners Contents Chapter 1Beginning With Python 1.1. Context Learn Python in 10 minutes NOTE: If you would like some Python development done, my company, Stochastic Technologies, is available for consulting. This tutorial is available as a short ebook. The e-book features extra content from follow-up posts on various Python best practices, all in a convenient, self-contained format.
Python — imaplib IMAP example with Gmail I couldn’t find all that much information about IMAP on the web, other than the RFC3501. The IMAP protocol document is absoutely key to understanding the commands available, but let me skip attempting to explain and just lead by example where I can point out the common gotchas I ran into. Let’s start by searching our inbox for all mail with the search function. Use the built in keyword “ALL” to get all results (documented in RFC3501). The Lair of the Python Welcome to the home of the Voidspace Python pages. Not a snake, Python is a dynamic scripting language with a beautifully clean syntax. There's lots of code here to peruse, as well as the Techie Blog which explores life from the point of view of a Pythoneer. Python is a dynamic, object orientated, programming language. Its focus is on allowing the programmer the maximum freedom and expressiveness.
Python Dict and File - Educational Materials Dict Hash Table Looking up or setting a value in a dict uses square brackets, e.g. dict['foo'] looks up the value under the key 'foo'. Strings, numbers, and tuples work as keys, and any type can be a value. Other types may or may not work correctly as keys (strings and tuples work cleanly since they are immutable). Looking up a value which is not in the dict throws a KeyError -- use "in" to check if the key is in the dict, or use dict.get(key) which returns the value or None if the key is not present (or get(key, not-found) allows you to specify what value to return in the not-found case).
Python In One Easy Lesson Nick Parlante Nov 2010 This is a one-hour introduction to Python used for Stanford's CS107. This material should work as an introduction for any experienced programmer. We'll look at some core Python features and get a feel for how it compares to other languages.