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 […]
How to SSH Without Typing Password?
If you login to a Linux server/cluster frequently, it might get little painful to type your password every time. If the computer you use to login to the cluster is safe and secure, you can easily set your computer so that you can login to Linux server/cluster (and copy files between the machines using SCP) […]