Exercises, examples and other material relating to training module Y115. This topic is presented on public courses
Learning to program in Python,
Python Programming
If you have a process that you want to do several things at the same time, threads may be the answer for you. They let you set up a series of processes ... http://www.wellho.net/solutions/python-p ... ample.html [longer article] |
Python Programming - The fundamentals in depth, and an introduction to applications such as GUI design and Data Munging.
This course starts at the fundamentals ... http://www.wellho.net/course/ypfull.html [course] |
Learning to Program in Python - The fundamentals in depth, and an introduction to applications such as GUI design and Data Munging.
This course starts ... http://www.wellho.net/course/ylfull.html [course] |
#!/usr/bin/python
import os
for param in os.environ.keys():
print "%20s %s" % (param,os.environ[param])
"""
These are the standard Python environment ... http://www.wellho.net/resources/ex.php4?item=y115/penv.py [code sample] |
Good question - came up on the course yesterday and all the examples I could find were longwinded or obfursacted to avoid them abusing the email addresses ... http://www.wellho.net/mouth/1043_Sen ... ython.html [short article] |
Do you want to ignore case in a regular expression? There are a variety of ways of doing it ... depending on the language you're writing. Here are ... http://www.wellho.net/mouth/1336_Ign ... ssion.html [short article] |
div class= introsubheads PATTERN MATCHING (OR HOW TO DO A LOOK LIKE) BR /div
You can test a string against a pattern (known as a REGULAR EXPRESSION ... http://www.wellho.net/solutions/php-patt ... sions.html [longer article] |
Python is a wide-ranging language, so you won't have learnt everything about it on the early stages of your course. In this module, we assume fundamentals knowledge, and we go on to cover some of the more advanced features of the language that you'll need as you go on to write larger applications of the type that Python's so well suited to.
This topic is presented on public courses
Learning to program in Python,
Python Programming
Examples from our training material
| bench.py | Find largest 5 files in or below a directory |
| class_v_static.py | Decorators - your own, plus @classmethod and @staticmethod |
| cli.py | Report on command line parameters |
| cpick | Store an object via cPickle |
| cunpick | recover a pickled object |
| currency.py | Formatting a currency using Regular Expression |
| emma | Regular expression then split |
| eo2.py | Scanning log file for instability |
| flist.py | All the files in a directory - which is largest? |
| gad1.py | Create a Gadfly (SQL) database and insert data |
| gad2.py | Running an SQL query - Gadfly |
| get_os.py | Get Operating System information |
| hostfilter.py | Extract host computer information - strip comments with regular expressions |
| mar_in.py | Loading in an object saved via the marshal module |
| mar_out.py | Marshal converts an object to a string |
| myuser.py | class for use in pickle / unpickle demo |
| penv.py | Python environment variables |
| pocohunter | Looking for postcodes in a string |
| psplit | Splitting at a string v splitting at a regular expression |
| py_mysql.py | MySQL to Python using MySQL Connector |
| pysql_another | Using a MySQL database - select across multiple tables |
| python_mysql_web.py | Python, MySQL, CGI (Web) board |
| re1.py | Regular expression - first example |
| re2.py | Stripping spaces |
| re3.py | Find email addresses in line of text |
| re4.py | Regular expression split over several lines |
| refun | evaluating a net list in EQN format |
| relib.py | Some common regular expressions |
| retest.py | Regular Expression test engine |
| sql1.py | Hello MySQL World in Python |
| sql1a.py | MySQL to Python using MySQLdb |
| sqlite.py | Sqlite3 / Python 3 example |
| subp | Subprocess module - replacement for os.popen |
| syscommand | Running an operating system command in Python |
| tim | Some time handlers |
| timestuff.py | Some time handling |
Background information
Some modules are
available for download as a sample of our material or under an
Open Training Notes License for free download from
http://www.training-notes.co.uk.
Topics covered in this module
Is Python compiled or interpreted?.
Regular expressions in Python.
Elements of a Python-style regular expression.
Anchors (Assertions).
Literal characters.
Character groups.
Counts.
Alternation.
Grouping.
Modifiers.
Some examples.
Methods available on Python regular expressions.
Some more examples and features of regular expressions.
Some popular regular expressions.
Running Python and system commands from within.
Handling dates and times in Python.
Pickling and shelving.
Accessing the environment from Python.
Talking to SQL databases from Python.
Complete learning
If you are looking for a complete course and not just a information on a single subject, visit our
Listing and schedule page.
Well House Consultants specialise in training courses in
Python,
Perl,
PHP, and
MySQL. We run
Private Courses throughout the UK (and beyond for longer courses), and
Public Courses at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if
you live in a different
country or continent to us.
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.