Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- text1 = "AAA1/2/2019EDI"
- text2 = "AAA1/28/2019EDI"
- text3 = "AAA12/8/2019EDI"
- text4 = "AAA12/28/2019EDI"
- def gn1(text):
- eloc = text.find('EDI')
- if text[eloc - 6] == "/":
- start = eloc - 9
- print(text[start])
- print('if', start)
- else:
- start = eloc - 8
- print(text[start])
- print('else', start)
- if text[start - 1].isdigit():
- start -= 1
- print('secondif', start)
- return text[start:eloc]
- def gn(text):
- eloc = text.find('EDI')
- start = text.find('/', eloc !!!backwards)
- if gn(text1) == "1/2/2019":
- print("text1 success!")
- else:
- print(gn(text1))
- if gn(text2) == "1/28/2019":
- print("text2 success!")
- else:
- print(gn(text2))
- if gn(text3) == "12/8/2019":
- print("text3 success!")
- else:
- print(gn(text3))
- if gn(text4) == "12/28/2019":
- print("text4 success!")
- else:
- print(gn(text4))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement