Advertisement
zero_shubham1

regex module

Oct 31st, 2015
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 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. if (f_num==9):
  9. print("YES")
  10.  
  11. else : print("NO")
  12.  
  13. if __name__ == '__main__':
  14. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement