01-05-2021




Python Home
Introduction
Running Python Programs (os, sys, import)
Modules and IDLE (Import, Reload, exec)
Object Types - Numbers, Strings, and None
Strings - Escape Sequence, Raw String, and Slicing
Strings - Methods
Formatting Strings - expressions and method calls
Files and os.path
Traversing directories recursively
Subprocess Module
Regular Expressions with Python
Regular Expressions Cheat Sheet
Object Types - Lists
Object Types - Dictionaries and Tuples
Functions def, *args, **kargs
Functions lambda
Built-in Functions
map, filter, and reduce
Decorators
List Comprehension
Sets (union/intersection) and itertools - Jaccard coefficient and shingling to check plagiarism
Hashing (Hash tables and hashlib)
Dictionary Comprehension with zip
The yield keyword
Generator Functions and Expressions
generator.send() method
Iterators
Classes and Instances (__init__, __call__, etc.)
if__name__ '__main__'
argparse
Exceptions
@static method vs class method
Private attributes and private methods
bits, bytes, bitstring, and constBitStream
json.dump(s) and json.load(s)
Python Object Serialization - pickle and json
Python Object Serialization - yaml and json
Priority queue and heap queue data structure
Graph data structure
Dijkstra's shortest path algorithm
Prim's spanning tree algorithm
Closure
Functional programming in Python
Remote running a local file using ssh
SQLite 3 - A. Connecting to DB, create/drop table, and insert data into a table
SQLite 3 - B. Selecting, updating and deleting data
MongoDB with PyMongo I - Installing MongoDB ...
Python HTTP Web Services - urllib, httplib2
Web scraping with Selenium for checking domain availability
REST API : Http Requests for Humans with Flask
Blog app with Tornado
Multithreading ...
Python Network Programming I - Basic Server / Client : A Basics
Python Network Programming I - Basic Server / Client : B File Transfer
Python Network Programming II - Chat Server / Client
Python Network Programming III - Echo Server using socketserver network framework
Python Network Programming IV - Asynchronous Request Handling : ThreadingMixIn and ForkingMixIn
Python Coding Questions I
Python Coding Questions II
Python Coding Questions III
Python Coding Questions IV
Python Coding Questions V
Python Coding Questions VI
Python Coding Questions VII
Python Coding Questions VIII
Image processing with Python image library Pillow
Python and C++ with SIP
PyDev with Eclipse
Matplotlib
Redis with Python
NumPy array basics A
NumPy Matrix and Linear Algebra
Pandas with NumPy and Matplotlib
Celluar Automata
Batch gradient descent algorithm
Longest Common Substring Algorithm
Python Unit Test - TDD using unittest.TestCase class
Simple tool - Google page ranking by keywords
Google App Hello World
Google App webapp2 and WSGI
Uploading Google App Hello World
Python 2 vs Python 3
virtualenv and virtualenvwrapper
Uploading a big file to AWS S3 using boto module
Scheduled stopping and starting an AWS instance
Cloudera CDH5 - Scheduled stopping and starting services
Removing Cloud Files - Rackspace API with curl and subprocess
Checking if a process is running/hanging and stop/run a scheduled task on Windows
Apache Spark 1.3 with PySpark (Spark Python API) Shell
Apache Spark 1.2 Streaming
bottle 0.12.7 - Fast and simple WSGI-micro framework for small web-applications ...
Flask app with Apache WSGI on Ubuntu14/CentOS7 ...
Selenium WebDriver
Fabric - streamlining the use of SSH for application deployment
Ansible Quick Preview - Setting up web servers with Nginx, configure enviroments, and deploy an App
Neural Networks with backpropagation for XOR using one hidden layer
NLP - NLTK (Natural Language Toolkit) ...
RabbitMQ(Message broker server) and Celery(Task queue) ...
OpenCV3 and Matplotlib ...
Simple tool - Concatenating slides using FFmpeg ...
iPython - Signal Processing with NumPy
iPython and Jupyter - Install Jupyter, iPython Notebook, drawing with Matplotlib, and publishing it to Github
iPython and Jupyter Notebook with Embedded D3.js
Downloading YouTube videos using youtube-dl embedded with Python
Machine Learning : scikit-learn ...
Django 1.6/1.8 Web Framework ...

Regex Syntax¶

Regex Cheat Sheet. GitHub Gist: instantly share code, notes, and snippets. Description (?:) Don’t capture group. 250-5 Match 251-255 pattern. 20-40-9 Match 200-249 pattern 1?0-90-9 Match 0-199 pattern. Regular Expressions Cheat Sheet for Python, PHP, Perl, JavaScript and Ruby developers. The list of the most important metacharacters you'll ever need.

Characters
CharacterMatches
aa character
.Any character (except newline)
.. character
character
** character
Character Classes
MatchesDescription
[abcd]Any one of the letters a through dSet of characters
[^abcd]Any character but a, b, c, or dComplement of a set of characters
[a-d]Any one of the letters a through dRange of characters
[a-dz]Any of a, b, c, d, or zRange of characters
RegexPython Regex Cheatsheet
Special Sequences
TypeExpressionEquivalent ToDescription
Word Characterw[a-zA-Z0-9_]Alphanumeric or underscore
Non-word CharacterW[^a-zA-Z0-9_]Anything but a word character
Digit Characterd[0-9]Numeric
Non-digit CharacterD[^0-9]Non-numeric
Whitespace Characters[tnrfv]Whitespace
Non-whitespace CharacterS[^tnrfv]Anything but a whitespace character
Anchors
AnchorMatches
^Start of the string
$End of the string
bBoundary between word and non-word characters
Groups
Group TypeExpression
Capturing( ... )
Non-capturing(?: ... )
Quantifiers/Repetition
QuantifierModification
{5}Match expression exactly 5 times
{2,5}Match expression 2 to 5 times
{2,}Match expression 2 or more times
{,5}Match expression 0 to 5 times
*Match expression 0 or more times
{,}Match expression 0 or more times
?Match expression 0 or 1 times
{0,1}Match expression 0 or 1 times
+Match expression 1 or more times
{1,}Match expression 1 or more times
Non-greedy quantifiers
QuantifierModification
{2,5}?Match 2 to 5 times (less preferred)
{2,}?Match 2 or more times (less preferred)
{,5}?Match 0 to 5 times (less preferred)
*?Match 0 or more times (less preferred)
{,}?Match 0 or more times (less preferred)
??Match 0 or 1 times (less preferred)
{0,1}?Match 0 or 1 times (less preferred)
+?Match 1 or more times (less preferred)
{1,}?Match 1 or more times (less preferred)
Alternators
QuantifierModification
ABC|DEFMatch string ABC or string DEF
Python Regex Cheatsheet
Lookaround
QuantifierModification
(?=abc)Zero-width match confirming abc will match upcoming chars
(?!abc)Zero-width match confirming abc will not match upcoming chars

Python¶

functions
FunctionPurposeUsage
re.searchReturn a match object if pattern found in stringre.search(r'[pat]tern','string')
re.finditerReturn an iterable of match objects (one for each match)re.finditer(r'[pat]tern','string')
re.findallReturn a list of all matched strings (different when capture groups)re.findall(r'[pat]tern','string')
re.splitSplit string by regex delimeter & return string listre.split(r'[-]','st-ring')
re.compileCompile a regular expression pattern for later usere.compile(r'[pat]tern')
flags
FlagDescription
re.IGNORECASEMatch uppercase and lowercase characters interchangeably
re.VERBOSEIgnore whitespace characters and allow # comments

How To Use Regex In Python

I send out 1 Python exercise every week through a Python skill-building service called Python Morsels.

Python Regex Cheatsheet Pdf

If you'd like to improve your Python skills every week, sign up!

Python Regex Cheat Sheets

You can find the Privacy Policy here.

Re Cheat Sheet

reCAPTCHA protected (Google Privacy Policy & TOS)