I am new to Python.. I want to know how can be the number of lines can be reduced? My task is to print whatever Simon says from the text file given below. the o/p should be sing,dance, go to school.
Is there any way to make the following program (xxxx.py) file in a single line of code?


I say: Play Cricket
Simon Says: Sing
Simon Says: Dance
Simon Says: Go to School
I say: Dance

xxx.py file

import sys
p = open('simonfile.txt')
for i in p.readlines():
if ( s[0]=="Simon Says"):
print " S[0] " ,s[0]

You can try a statement like this one

print(''.join(s[len("SimonSays: "):] for s in open("simonfile.txt") if s.startswith("SimonSays: ")))