Posts tagged 'tips'

Luca Lanziani

Browser as notepad

From time to time I need to note something down, from a snippet of code to some lorem ipsum.

Of course I can open a text editor and paste the text there but is it worth it to keep another window around when I have already a browser open in ...

Luca Lanziani

Python - validate command line args

Ok, in the last article I've shown you a tool to write a nice command line interface, but it doesn't help you on validation.

try:
    level = int(args['--log-level'])
except ValueError:
    raise ArgsError('--log-level has to be a valid integer')

Manual validation? There is a much better way ...

Luca Lanziani

Python - command line interface

How to write a better command line interface with python...

Writing the Nth python shell script I found myself looking again at the documentation of argparse, A NIGHTMARE. After 15 minutes spent trying to understand how to use it I gave up.

Is in that moment that I've found ...