A number of beautiful and powerful programming languages, like Python, Ruby, and Perl are available for scripting needs. Even then you may find the old school unix shell scripting very useful tool to learn and use. For sure, shell scripts looks crazy and hard to read/understand. Once you get a hang of it, you might […]
Mastering Lists in Python Using List Comprehensions
Ever faced the problem of creating a unique lists in Python? or Accessing only specific elements of lists in Python? Python’s “List Comprehensions” offers you the immense power to create and use lists. Here is a brief introduction to understand and getting started on using List Comprehensions in Python. Python’s List Comprehensions Example 1 The […]
Getting Started With Map, Filter, and Reduce in Python
Python has a couple of nice built-in function in the flavor of functional programming paradigm. These built-in functions like map, filter, and apply combine very well with lambda functions. Map, filer, and reduce help you create, work with and tame lists in Python. For example sure, at some point you will have to deal with […]
Running Python Command Line and Getting Arguments
When you are writing a python program and want to run the Python script as a command from the terminal, you may want to get the arguments to the python program from command line. For example, you might want to execute the Python script and use its arguments. Python myPythonWithArguments.py input1 input2 Python’s sys module’s […]
How to Get a Specific Line or Lines From a Big File? Hint: Use One Liner AWK
If you are working with a huge text file with millions of lines and want to know the content of a specific line, there are a few tricks you can play to get the line you want. The naive approach of reading the file line by line (say in python) and keeping a count on […]