background preloader

Python Bibliotheca

Python Bibliotheca

A Python Book: Beginning Python, Advanced Python, and Python Exercises 2.2 Regular Expressions For more help on regular expressions, see: 2.2.1 Defining regular expressions A regular expression pattern is a sequence of characters that will match sequences of characters in a target. The patterns or regular expressions can be defined as follows: Literal characters must match exactly. Because of the use of backslashes in patterns, you are usually better off defining regular expressions with raw strings, e.g. r"abc". 2.2.2 Compiling regular expressions When a regular expression is to be used more than once, you should consider compiling it. import sys, re pat = re.compile('aa[bc]*dd') while 1: line = raw_input('Enter a line ("q" to quit):') if line == 'q': break if pat.search(line): print 'matched:', line else: print 'no match:', line Comments: We import module re in order to use regular expresions.re.compile() compiles a regular expression so that we can reuse the compiled regular expression without compiling it repeatedly. 2.2.3 Using regular expressions Notes:

Hidden features of Python Python Course Uta Priss This is a generic version of a class "Computer Programming for Information Management" that I taught twice a year at the School of Library and Information Science, Indiana University Bloomington. The materials in this course are mostly self-explanatory and can be used for self study. (There are some references in the materials to Indiana University accounts and settings which should be ignored.) Notes: 1) The materials in this course are copyrighted. 2) Please only contact me in case you find errors in the text or have comments. 3) I will not be responsible for any possible damage that any of the scripts and exercises in this course may have. Week 1. ExercisesAnswers Week 2. Beginning Python Programming — Beginning Python Programming for Aspiring Web Developers Navigation Beginning Python Programming¶ for Aspiring Web Developers¶ Using Python 3 by Jeffrey Elkner (with liberal borrowings from the work of Allen B. Last updated: 15 December 2015 Copyright NoticeContributor ListChapter 1 The way of the programChapter 2 Values, expressions, and statementsChapter 3 Strings, lists, and tuplesChapter 4 Conditionals and loopsChapter 5 FunctionsChapter 6 Dictionaries, sets, files, and modulesChapter 7 Classes and objectsChapter 8 InheritanceChapter 9 Server-side scriptingAppendix A Configuring Ubuntu for Python web developmentGNU Free Document License Search Page © Copyright 2014, Jeffrey Elkner.

BeginnersGuide/Programmers This is a Wiki page. Users with edit rights can edit it. You are, therefore, free to (in fact, encouraged to) add details of material that other Python users will find useful. It is not an advertising page and is here to serve the whole Python community. A beginner-friendly Python tutorial that starts with the absolute basics but also covers more advanced stuff like Python software deployment. Python Programming Language – Official Website 10 Free Python Programming Books Below is a collection of 10 great Python programming books that are available online in full, completely free of charge: Dive into Python This is a fantastic book that is also available in print . It covers everything, from installing Python and the language's syntax, right up to web services and unit testing. This is a good book to learn from, but it's also excellent to use a reference. An Introduction to Tkinter Tkinter is a popular cross-platform Python GUI toolkit, and this book provides a good introduction with lots of examples. How to think like a Computer Scientist This book uses Python to explain some Computer Science principals. The Standard Python Library This book provides a detailed description and usage examples for all of the modules in Python's standard library. Invent Your Own Computer Games with Python This book is aimed at novice programmers who are interested in writing simple computer games. The Django Book The Pylons Book Pylons is another Python web framework. too.

Related: