How to read and write to files using python programming language ?