當前位置: 首頁>>代碼示例>>Python>>正文


Python Formatter.formatTimes方法代碼示例

本文整理匯總了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)
開發者ID:phuston,項目名稱:iCalOlin,代碼行數:48,代碼來源:views.py

示例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):
開發者ID:phuston,項目名稱:iCalOlin,代碼行數:33,代碼來源:main.py


注:本文中的Formatter.formatTimes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。