Follow me
-
Recent Posts
calendar
Recent Comments
- Stan on python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)
- Cormac on Pandas : how to compare dataframe with None
- LP on AWK: the substr command to select a substring
- jrab on python argparse issues with the help argument (TypeError: %o format: a number is required, not dict)
- How to disable SSL verification for urlretrieve? – Peter's blog on python: certificate verified failed
Archives
Categories
Meta
Daily Archives: December 26, 2017
Difference between __repr__ and __str__ in Python
When implementing a class in Python, you usually implement the __repr__ and __str__ methods. __str__ should print a readable message __repr__ should print a message that is unambigous (e.g. name of an identifier, class name, etc). You can see __str__ … Continue reading
python: how to merge two dictionaries
Let us suppose two dictionaries storing ages of different individuals: list1 = {"Pierre": 28, "Jeanne": 27} list2 = {"Marc": 32, "Helene": 34}list1 = {"Pierre": 28, "Jeanne": 27} list2 = {"Marc": 32, "Helene": 34} If you do mind losing the contents … Continue reading
Search for a pattern in a set of files using find and grep commands
A common task for developers is to search for a pattern amongst a bunch of files that are in different directories. For instance, you are looking for the pattern “import sys” within a set of Python files. Those files are … Continue reading