Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyinputplus as pyip
- response = pyip.inputYesNo('Yes or no? ')
- response
- string = printmd('what? ')
- choice = pyip.inputMenu(['1', '2'], prompt='')
- def formattedSel(text):
- try:
- int(text[:6])
- except:
- raise Exception('Enter valid <aDs>')
- if not text.endswith('<aDs>'):
- raise Exception('Enter valid <aDs>')
- prompt = printmd('Enter your aDs')
- ads = pyip.inputCustom(formattedSel, prompt='')
- ads = ads.strip()
- def formattedDate(text):
- try:
- int(text)
- except:
- raise Exception('Enter valid date')
- if not text.startswith('20') or len(text) != 8:
- raise Exception('Enter valid date')
- dateprompt = printmd('Enter your date')
- dateOne = pyip.inputCustom(formattedDate, prompt='').strip()
- while True:
- date2prompt = printmd('Enter your 2nd date')
- dateTwo = pyip.inputCustom(formattedDate, prompt='').strip()
- if dateTwo > dateOne:
- break
- elif dateTwo == dateOne:
- print("Dates cannot be the same. ")
- else:
- print('Wrong order. ')
- def formatDateforQuery(date):
- date = date[:4] + '-' + date[4:6] + '-' + date[6:] + 'T00:00:00'
- return date
- dateOneFormatted = formatDateforQuery(dateOne)
- dateTwoFormatted = formatDateforQuery(dateTwo)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement