Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Hands on the Python Module argparse

  1. argparse is the best library to use to parse command-line arguments in Python. It is included in Python standard libaries (which menas that you can use it out of the box).

  2. It is suggestedd that you always log a parsed Namespace object so that you can check whether it is as expected.

Hands on the Python Module argparse

  1. argparse is the best library to use to parse command-line arguments in Python. It is included in Python standard libaries (which menas that you can use it out of the box).

  2. It is suggestedd that you always log a parsed Namespace object so that you can check whether it is as expected.

Advanced Use of "head" and "tail"

It is suggested that you use Python instead of Shell to manipulate text files!!

Besides passing an unsigned integer as parameter to the option -n, you can also pass a signed integer to it. When a signed integer is passed to -n, it means from/to (inclusive/exclusive similar to …

Sample Lines from a File Using Command Line

NOTE: the article talks about sampling "lines" rather than "records". If a records can occupy multiple lines, e.g., if any field contains a new line (\n), the following tutorial does not work and you have to fall back to more powerful tools such as Python or R.

Let's say …