#!/usr/bin/python
a = "a.txt"
f = file(a)
c = f.readlines()
while True:
user_input = raw_input("plz input your name:").strip()
if len(user_input) == 0:continue
for line in c:
if user_input in line:
print line,
break
else:
print "it is not the user"原文地址:http://44994.blog.51cto.com/34994/1669884