import rex = " rs1982171 55349 40802".strip() if (re.match(r"\b55349\b",x.split()[1])): print x
Standard input is empty
rs1982171 55349 40802
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!