Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. import pyinputplus as pyip
  2. response = pyip.inputYesNo('Yes or no? ')
  3. response
  4. string = printmd('what? ')
  5. choice = pyip.inputMenu(['1', '2'], prompt='')
  6. def formattedSel(text):
  7. try:
  8. int(text[:6])
  9. except:
  10. raise Exception('Enter valid <aDs>')
  11. if not text.endswith('<aDs>'):
  12. raise Exception('Enter valid <aDs>')
  13. prompt = printmd('Enter your aDs')
  14. ads = pyip.inputCustom(formattedSel, prompt='')
  15. ads = ads.strip()
  16. def formattedDate(text):
  17. try:
  18. int(text)
  19. except:
  20. raise Exception('Enter valid date')
  21. if not text.startswith('20') or len(text) != 8:
  22. raise Exception('Enter valid date')
  23. dateprompt = printmd('Enter your date')
  24. dateOne = pyip.inputCustom(formattedDate, prompt='').strip()
  25. while True:
  26. date2prompt = printmd('Enter your 2nd date')
  27. dateTwo = pyip.inputCustom(formattedDate, prompt='').strip()
  28. if dateTwo > dateOne:
  29. break
  30. elif dateTwo == dateOne:
  31. print("Dates cannot be the same. ")
  32. else:
  33. print('Wrong order. ')
  34. def formatDateforQuery(date):
  35. date = date[:4] + '-' + date[4:6] + '-' + date[6:] + 'T00:00:00'
  36. return date
  37. dateOneFormatted = formatDateforQuery(dateOne)
  38. dateTwoFormatted = formatDateforQuery(dateTwo)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement