Snippets Of The Day – Thursday, September 26, 2013

Posted on Posted in Snippets

Orange set of tools as knives, scissors, corkscrew, openerHere are some of the most recently published snippets!

How to check key presence in a python dictionary

This is the simplest way to check if a given key is present in a dictionary.

Open the snippet

Author: lbottaro

Regular Expression In Python – Simple Grouping

This python code shows how to define a regular expression path and have it applied to some string. The regex is defined using the compile built-in method of re library. In the following example some groups are used to parse information from filename strings listed by ‘ls’ linux command. Exception will raise if no match will be found.

Open the snippet

Author: lbottaro

Leave a Reply

Your email address will not be published. Required fields are marked *