f = open('/etc/motd', 'r') allLineLens = [len(x.strip()) for x in f] f.close() print max(allLineLens)