f = open('script1.py') lines = f.readlines( ) print lines lines = [line.rstrip( ) for line in lines] print lines