Advertisement
zero_shubham1

regex module

Oct 31st, 2015
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. import re
  2.  
  3. def main():
  4. f = open('text.txt', 'r')
  5. for eachLine in f:
  6. if (len(eachLine)==10):
  7. f_num=re.search(r'^[789]',eachLine)
  8. m=f_num.group()
  9. print(m)
  10. if(m==9 or m==7 or m==8):
  11. print("YES")
  12.  
  13. else : print("NO")
  14.  
  15. if __name__ == '__main__':
  16. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement