Advertisement
Guest User

Parse1

a guest
Aug 22nd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 KB | None | 0 0
  1. text1 = "AAA1/2/2019EDI"
  2. text2 = "AAA1/28/2019EDI"
  3. text3 = "AAA12/8/2019EDI"
  4. text4 = "AAA12/28/2019EDI"
  5.  
  6. def gn1(text):
  7.     eloc = text.find('EDI')
  8.     if text[eloc - 6] == "/":
  9.         start = eloc - 9
  10.         print(text[start])
  11.         print('if', start)
  12.     else:
  13.         start = eloc - 8
  14.         print(text[start])
  15.         print('else', start)
  16.     if text[start - 1].isdigit():
  17.         start -= 1
  18.         print('secondif', start)
  19.     return text[start:eloc]
  20.    
  21. def gn(text):
  22.     eloc = text.find('EDI')
  23.     start = text.find('/', eloc !!!backwards)
  24.  
  25. if gn(text1) == "1/2/2019":
  26.     print("text1 success!")
  27. else:
  28.     print(gn(text1))
  29. if gn(text2) == "1/28/2019":
  30.     print("text2 success!")
  31. else:
  32.     print(gn(text2))
  33. if gn(text3) == "12/8/2019":
  34.     print("text3 success!")
  35. else:
  36.     print(gn(text3))
  37. if gn(text4) == "12/28/2019":
  38.     print("text4 success!")
  39. else:
  40.     print(gn(text4))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement