本文整理汇总了Python中Formatter.formatTimes方法的典型用法代码示例。如果您正苦于以下问题:Python Formatter.formatTimes方法的具体用法?Python Formatter.formatTimes怎么用?Python Formatter.formatTimes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formatter
的用法示例。
在下文中一共展示了Formatter.formatTimes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: index
# 需要导入模块: import Formatter [as 别名]
# 或者: from Formatter import formatTimes [as 别名]
def index():
username = None
password = None
email = None
form = loginForm()
if form.validate_on_submit():
try:
course_info = GetHTML.htmlHandle(form.username.data,form.password.data)
timesold = course_info[2]
names = course_info[1]
course_info[2] = Formatter.formatTimes(course_info[2])
sdates = {'M':'26','T':'20','W':'21','R':'22','F':'23'}
snames = {}
for i in range(len(timesold)):
snames[names[i]] = len(timesold[i])
dnames = {}
k = 0
for j in range(7):
for i in range(snames[names[j]]):
dnames[k] = names[j]
k += 1
filename = 'OliniCalendar.ics'
iCalCreation.iCalWrite(course_info[2],"201501","20150430T000000",sdates,dnames,filename)
ical = open('OliniCalendar.ics','r')
email = form.email.data
Emailer.iCalCreator(email,ical)
os.remove('OliniCalendar.ics')
# return render_template(html_sched)
form.username.data = ''
form.password.data = ''
form.email.data = ''
except:
"Oops"
return render_template('index.html', form=form)
示例2: str
# 需要导入模块: import Formatter [as 别名]
# 或者: from Formatter import formatTimes [as 别名]
endyearmonthdaytime = '20150430T000000'
USERNAME = str(raw_input("Enter my.olin.edu Username: "))
PASSWORD = getpass.getpass('Password: ')
email = str(raw_input("Email you want it sent to: "))
htmlResults = GetHTML.htmlHandle(USERNAME,PASSWORD)
num = htmlResults[0]
names = htmlResults[1]
times = htmlResults[2]
locs = htmlResults[3]
timesold = times
times = Formatter.formatTimes(times)
sdates = {'M':'26','T':'20','W':'21','R':'22','F':'23'}
# The following code correlates the classes to each timeslot created from formatTimes.
# Essentially, I screwed up somewhere and both times for the classes are not kept together and "time slots" are made instead. This just maps each class to it's respective slots.
snames = {}
for i in range(len(timesold)):
snames[names[i]] = len(timesold[i])
dnames = {}
k = 0
for j in range(7):