Print next characters in line Python -


i looking make simple program find character , print next 10 characters in line. have been able make print out whole line , rest of line useless. have now.

f = open("active notship.txt", "r") searchlines = f.readlines() f.close() i, line in enumerate(searchlines):     if "p-" in line:         print line 

kevin right. did.

f = open("active notship.txt", "r") searchlines = f.readlines() f.close() i, line in enumerate(searchlines):     if "p-" in line:         print line[3:13] 

Comments

Popular posts from this blog

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -