Archive

Archive for January, 2015

Python: Tips, Tricks and Idioms – Part 1

January 30, 2015 Leave a comment

A must read

https://codefisher.org/catch/blog/2015/01/27/python-tips-tricks-and-idioms/

Advertisements
Categories: Interesting, python

Text manipulation with paste command

January 21, 2015 Leave a comment

Awesome post from Zipzap

Unix/Linux and Ubuntu tips-and-tricks

Have a look at the power of the “paste” comand – it just solves a bunch of situations with ease, and its litle known… transpose pair a lines into 2 columns, etc…

Have a look to these examples to get an idea of “paste” power…

http://www.theunixschool.com/2012/07/10-examples-of-paste-command-usage-in.html

View original post

Categories: bash, Interesting Tags:

Cutting and Slicing strings in python

January 21, 2015 Leave a comment

Problem:
I needed to get alternative characters in a string.

Solution:

>>> word = “Mouse”
>>> word[::2]
‘Mue’
>>> word[1::2]
‘os’

Source:
https://stackoverflow.com/questions/20847205/program-to-extract-every-alternate-letters-from-a-string-in-python
http://www.pythoncentral.io/cutting-and-slicing-strings-in-python/