File Processing

I need an help on the below requirement:

I need to add few columns to the end of the file. Few columns should be populated with default values and few columns to be derived based on the data in the record or a Data Base Function. How can we implement this in Python?