当前位置: 首页>>代码示例>>Python>>正文


Python HTML.table方法代码示例

本文整理汇总了Python中html.HTML.table方法的典型用法代码示例。如果您正苦于以下问题:Python HTML.table方法的具体用法?Python HTML.table怎么用?Python HTML.table使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在html.HTML的用法示例。


在下文中一共展示了HTML.table方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _AddReportSection

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
 def _AddReportSection(self, pb, type, modes, fountains, sinks, orphans):
     modes = [str(mode) for mode in modes]
     
     h = HTML()
     
     plural = ''
     if len(modes) > 1: plural = "s"
     sectionTitle = "{0} results for mode{1} {2!s}".format(type, plural, modes)
     
     #h.h3(sectionTitle)
     
     nFountains = len(fountains)
     nSinks = len(sinks)
     nOrphans = len(orphans)
     
     if nFountains > 0:
         
         plural = ''
         if nFountains > 1: plural = 's'
         title= "Found %s fountain node%s:" %(nFountains, plural)
         
         t = h.table()
         tr = t.tr()
         tr.th(title)
         
         for node in fountains:
             t.tr().td(str(node))
         
     if nSinks > 0:
         
         plural = ''
         if nSinks > 1: plural = 's'
         title= "Found %s sink node%s:" %(nSinks, plural)
         
         t = h.table()
         tr = t.tr()
         tr.th(title)
         
         for node in sinks:
             t.tr().td(str(node))
             
     if nOrphans > 0:
         
         plural = ''
         if nOrphans > 1: plural = 's'
         title= "Found %s orphan node%s:" %(nOrphans, plural)
         
         t = h.table()
         tr = t.tr()
         tr.th(title)
         
         for node in orphans:
             t.tr().td(str(node))
     
     pb.wrap_html(sectionTitle, body= str(h))
开发者ID:nmpeterson,项目名称:TMGToolbox,代码行数:57,代码来源:check_network_connectivity.py

示例2: send_email

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
def send_email(user, event, message, **kw):
  if not user in config['email']['user_emails']:
    return

  args = {
    'f': config['email']['from_address'],
    't': config['email']['user_emails'][user],
    'u': kw['subject'] if 'subject' in kw else 'Notification',
  }

  if not 'app' in kw:
    kw['app'] = config['default_app']

  body = HTML('html')
  tr = body.table().tr()
  tr.td(valign='top').img(src=config['icons'][kw['app']], style='float:left; margin: 15px')
  try:
    if 'email_body' in kw:
      tr.td().text(kw['email_body'], escape=False)
    else:
      getattr(notifications, event + '_email')(tr.td(), message, **kw)
  except:
    with tr.td().p(style='margin-top: 15px') as p:
      p.b("Message:")
      p.br()
      p.text(message)

  ip = curl('ifconfig.me').strip()
  if ip != config['ip']:
    ybdst = ssh.bake(config['ip'])
    print "Sent %s email to %s" % (event, user)
    return ybdst.sendemail(_in=str(body), **args)
  else:
    print "Sent %s email to %s" % (event, user)
    return sendemail(_in=str(body), **args)
开发者ID:adharris,项目名称:yb-scripts,代码行数:37,代码来源:notifications.py

示例3: getHTMLTeamTable

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
 def getHTMLTeamTable(self, div_age, div_gen, team_id):
     # https://pypi.python.org/pypi/html/
     return_dict = self.get_schedule('team_id', team_id,
         div_age=div_age, div_gen=div_gen)
     game_list = return_dict['game_list']
     html = HTML()
     table = html.table(width='100%', border='1px solid black')
     table.caption(self.userid_name+" "+self.schedcol_name+" "+div_age+div_gen+str(team_id))
     header_row = table.tr
     header_row.th('Game Date', padding='5px')
     header_row.th('Start Time', padding='5px')
     header_row.th('Field', padding='5px')
     header_row.th('Home', padding='5px')
     header_row.th('Away', padding='5px')
     for game in game_list:
         game_row = table.tr
         game_row.td(game['game_date'])
         game_row.td(game['start_time'])
         findex = self.fieldinfo_indexerGet(game['venue'])
         if findex is not None:
             field_name = self.fieldinfo_list[findex]['field_name']
             game_row.td(field_name)
         game_row.td(str(game['home']))
         game_row.td(str(game['away']))
     return str(html)
开发者ID:yukonhenry,项目名称:datagraph,代码行数:27,代码来源:schedmaster.py

示例4: create_table

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
    def create_table(self, tg):
        '''
        Given a tableGroup element returns html marked up table wrapped in a div
        '''
        

        h = HTML.table()
开发者ID:FraserEmbletonSmith,项目名称:OCW_DB_SCRIPTS,代码行数:9,代码来源:xmlfunctions.py

示例5: _WriteErrorReport

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
 def _WriteErrorReport(self, errorTable):
     h = HTML()
     
     t = h.table()
     tr = t.tr()
     tr.th("Line ID")
     tr.th("Error Message")
     tr.th("Error Details")
     
     for lineId, errorMsg, errorDetail in errorTable:
         tr = t.tr()
         tr.td(lineId)
         tr.td(errorMsg)
         tr.td(str(errorDetail))
     
     pb = _m.PageBuilder(title= "Error Report")
     
     headerText = "<b>Source Emmebank:</b> %s" %self.SourceEmmebankPath +\
                 "<br><b>Source Scenario:</b> %s" %self.SourceScenarioId +\
                 "<br><b>Target Scenario:</b> %s" %self.TargetScenario
     
     pb.add_text_element(headerText)
     
     pb.wrap_html(body= str(t))
     
     _m.logbook_write("Error report", value= pb.render())
     
     pass
         
开发者ID:MTTST,项目名称:TMGToolbox,代码行数:30,代码来源:copy_transit_lines.py

示例6: create_binary_correlation_stat_html

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
    def create_binary_correlation_stat_html(self, output_dir, roidb=None):
        from html import HTML
        # Create the directory if necessary
        if not osp.exists(output_dir):
            os.makedirs(output_dir)

        present_cache_file = osp.join(self.cache_path, self.name + '_present_stats.pkl')
        assert os.path.exists(present_cache_file)

        with open(present_cache_file, 'rb') as fid:
            present_stats = cPickle.load(fid)
        print '{} present stats loaded from {}'.format(self.name, present_cache_file)

        config_html = HTML()
        config_table = config_html.table(border='1')

        for i in xrange(self.num_classes):
            r = config_table.tr
            if i == 0:
                r.th('---')
            else:
                r.th('%s'%self.classes[i])
            for j in xrange(1, self.num_classes):
                c = r.td
                if i == 0:
                    c.a('%s'%self.classes[j])
                else:
                    c.a('%d'%int(present_stats[i, j]), href='images/%02d_%02d.jpg'%(i,j))

        html_file = open(osp.join(output_dir, 'coco_offsets_table.html'), 'w')
        print >> html_file, config_table
        html_file.close()
开发者ID:liuguoyou,项目名称:who_where,代码行数:34,代码来源:imdb.py

示例7: writeHTML

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
def writeHTML(options):
    from html import HTML

    titles = options.titles

    h = HTML('html')
    h.p('Results')
    h.br()
    path = '.'
    #methods = ['planenet', 'pixelwise', 'pixelwise+RANSAC', 'GT+RANSAC', 'planenet+crf', 'pixelwise+semantics+RANSAC']
    #methods = ['planenet', 'pixelwise', 'pixelwise+RANSAC', 'GT+RANSAC']

    for image_index in xrange(options.numImages):

        t = h.table(border='1')
        r_inp = t.tr()
        r_inp.td('input ' + str(image_index + options.startIndex))
        r_inp.td().img(src=path + '/' + str(image_index + options.startIndex) + '_image.png')

        r = t.tr()
        r.td('methods')
        for method_index, method in enumerate(titles):
            r.td(method)
            continue
        
        r = t.tr()
        r.td('segmentation')
        for method_index, method in enumerate(titles):
            r.td().img(src=path + '/' + str(image_index + options.startIndex) + '_segmentation_pred_' + str(method_index) + '.png')
            r.td().img(src=path + '/' + str(image_index + options.startIndex) + '_segmentation_pred_blended_' + str(method_index) + '.png')            
            continue

        r = t.tr()
        r.td('depth')
        for method_index, method in enumerate(titles):
            r.td().img(src=path + '/' + str(image_index + options.startIndex) + '_depth_pred_' + str(method_index) + '.png')
            continue
        h.br()
        continue

    metric_titles = ['depth error 0.1', 'depth error 0.2', 'depth error 0.3', 'IOU 0.3', 'IOU 0.5', 'IOU 0.7']

    h.p('Curves on plane accuracy')
    for title in metric_titles:
        h.img(src='curve_plane_' + title.replace(' ', '_') + '.png')
        continue
    
    h.p('Curves on pixel coverage')
    for title in metric_titles:
        h.img(src='curve_pixel_' + title.replace(' ', '_') + '.png')
        continue
    
    
    html_file = open(options.test_dir + '/index.html', 'w')
    html_file.write(str(h))
    html_file.close()
    return
开发者ID:euivmar,项目名称:PlaneNet,代码行数:59,代码来源:predict.py

示例8: page

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
    def page(self):
        pb = _tmgTPB.TmgToolPageBuilder(self, title="TMG Toolbox Index" ,
                     description="Lists all tools and libraries within the TMG Toolbox, \
                         alphabetically by tool name, with links to each tool.",
                     branding_text="- TMG Toolbox", runnable= False)
        
        tmg = [tb for tb in _MODELLER.toolboxes if tb.namespace() == 'tmg'][0]
        toolNames = self.get_tool_names(tmg)
        topCategories = self.get_top_categories(tmg)
        
        alphabetizedToolNames = {}
        for name, namespacce in toolNames:
            firstChar = name[0].upper()
            if firstChar in alphabetizedToolNames:
                alphabetizedToolNames[firstChar].append((name, namespacce))
            else:
                alphabetizedToolNames[firstChar] = [(name, namespacce)]
        orderedKeys = [key for key in alphabetizedToolNames.iterkeys()]
        orderedKeys.sort()
        
        for firstChar in orderedKeys:
            #pb.add_header(firstChar)
            
            toolNames = alphabetizedToolNames[firstChar]
            h = HTML()
            t = h.table(style= 'border-style:none;', width= '100%')
            tr = t.tr()
            tr.th(firstChar, colspan= '3', align= 'left')
            
            for name, namespace in toolNames:
                
                #Get description from the code
                tool = _MODELLER.tool(namespace)
                if hasattr(tool, 'short_description'):
                    description = tool.short_description()
                else:
                    description = "<em>--No description--</em>"
                
                #Determine the top-level category
                topNamespace = namespace.split('.')[1]
                if topNamespace in topCategories:
                    category = topCategories[topNamespace]
                else: continue #Skip top-level tool
                
                #Add data to table
                tr = t.tr()
                tr.td("<em>%s</em>" %category, escape= False, width= '20%')
                link = '<a data-ref="%s" class="-inro-modeller-namespace-link" style="text-decoration: none;">' %namespace
                link += name + "</a>"
                tr.td(link, escape= False, width= '40%')
                tr.td(description, escape= False, align= 'left')

            pb.wrap_html(body= str(t))
        
        return pb.render()
开发者ID:nmpeterson,项目名称:TMGToolbox,代码行数:57,代码来源:tool_list.py

示例9: dashboard

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
def dashboard():
    page = HTML()
    t = page.table()
    r = t.tr
    r.th("Count")
    r.th("Page name")
    for name in pageviews:
        r = t.tr
        r.td(str(pageviews[name]))
        r.td(name)
    return str(page)
开发者ID:parrt,项目名称:msan692,代码行数:13,代码来源:server.py

示例10: HtmlGen

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
class HtmlGen():
    def __init__(self,list_data):
        self.h = HTML()
	        
	self.table = self.h.table(border='2',align='center')
	
	
        for i in range(len(list_data)):
            self.r = self.table.tr
            self.r.td('%s'%str(i+1))
            self.r.td(list_data[i])
        print self.table
开发者ID:neemabhavsar,项目名称:TwitterTrafficTracker,代码行数:14,代码来源:html_gen.py

示例11: buy_used

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
    def buy_used(self, buy_info, used_info):
        alarm_num = 0
        used_info = Counter(all_type_list)
        buy_info = Counter(all_type_pur)
        # print used_info, buy_info, type(used_info)
        all_info = Counter(used_info + buy_info)
        # print all_info
        # print list(all_info)
        from html import HTML
        inline_css = {
            'class1': 'color:#00FF00;width:500;valign:middle;vertical-line:top;', #green
            'class2': 'color:#FF0000;width:500;valign:middle;vertical-line:top;', #red
            'class3': 'color:#FFFF00;width:500;valign:middle;vertical-line:top;', #yellow
            'class4': 'color:#000000;width:500;valign:middle;vertical-line:top;', #black
        }

        b = HTML()
        t = b.table(border='1px solid black')
        r = t.tr()
        t2 = t.tr()
        t3 = t.tr()
        r.td('Type', style=inline_css['class4'])
        t2.td('Purd', style=inline_css['class4'])
        t3.td('Used', style=inline_css['class4'])
        for m_title in list(all_info):
            r.td(str(m_title), style=inline_css['class4'])
            if m_title in dict(buy_info).keys():
                # print dict(buy_info)[m_title]
                t2.td(str(dict(buy_info)[m_title]), style=inline_css['class1'])
            else:
                # print 'no key'
                t2.td('Null', style=inline_css['class2'])
            if m_title in dict(used_info).keys():
                # print dict(used_info)[m_title]
                t3.td(str(dict(used_info)[m_title]), style=inline_css['class1'])
            else:
                # print 'nn key'
                t3.td('Null', style=inline_css['class2'])
            if m_title in dict(buy_info).keys() and m_title in dict(used_info).keys():
                if dict(buy_info)[m_title] < dict(used_info)[m_title]:
                    # print 'haha %s' % m_title
                    alarm_num = alarm_num + 1
            elif m_title not in dict(buy_info).keys() and m_title in dict(used_info).keys():
                # print 'used but not buy: %s' % m_title
                alarm_num = alarm_num + 1
            # elif m_title in dict(buy_info).keys() and m_title not in dict(used_info).keys():
            #     print 'buy but not used: %s' % m_title

        alarm_info_ec2 = {'status':str(alarm_num), 'report':str(b)}
        # print alarm_info_ec2
        return alarm_info_ec2
开发者ID:Arvon2014,项目名称:arvon-scripts,代码行数:53,代码来源:get_ec2_instance_list.py

示例12: _WriteErrorReport

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
 def _WriteErrorReport(self, linesMissingInNetwork):
     h = HTML()
     t = h.table()
     tr = t.tr()
     tr.th("Line ID")
     for id in linesMissingInNetwork:
         tr = t.tr()
         tr.td(str(id))
     
     pb = _m.PageBuilder(title="Lines not in network report")
     
     pb.wrap_html("Lines references in file but not in network", body= str(t))
     
     _m.logbook_write("Error report", value= pb.render())
开发者ID:nmpeterson,项目名称:TMGToolbox,代码行数:16,代码来源:export_boardings.py

示例13: _WriteMainReport

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
 def _WriteMainReport(self, reversedLines):
     h = HTML()
     t = h.table()
     tr = t.tr()
     tr.th('Original ID')
     tr.th('Reversed ID')
     
     for originalId, newId in  reversedLines:
         tr = t.tr()
         tr.td(originalId)
         tr.td(newId)
     
     pb = _m.PageBuilder(title= "Reversed Lines Report")
     pb.wrap_html(body= str(t))
     _m.logbook_write("Reversed lines report", value= pb.render())
开发者ID:MTTST,项目名称:TMGToolbox,代码行数:17,代码来源:reverse_transit_lines.py

示例14: _WriteErrorReport

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
 def _WriteErrorReport(self, errorLines):
     h = HTML()
     t = h.table()
     tr = t.tr()
     tr.th('Line ID')
     tr.th('Error Type')
     tr.th('Error Message')
     
     for lineId, errorType, errorMsg in errorLines:
         tr = t.tr()
         tr.td(lineId)
         tr.td(errorType)
         tr.td(errorMsg)
     
     pb = _m.PageBuilder(title= "Error Report")
     pb.wrap_html(body= str(t))
     _m.logbook_write("Error report", value= pb.render())
开发者ID:MTTST,项目名称:TMGToolbox,代码行数:19,代码来源:reverse_transit_lines.py

示例15: Html

# 需要导入模块: from html import HTML [as 别名]
# 或者: from html.HTML import table [as 别名]
class Html(object):
    def __init__(self):
        self.h = HTML()

    def table(self, title, data):
        self.t = self.h.table(border="1")
        self.t.caption(title)
        for i in data:
            r = self.t.tr
            for j in xrange(len(i)):
                r.td(str(i[j]))
        return str(self.t)

    def text(self, data):
        self.p = self.h.p()
        for line in data:
            self.p.text(str(line))
            self.p.br
        return str(self.h)

    def link(self, url):
        self.a = self.h.a(str(url))
        return str(self.a)
开发者ID:mechenglei,项目名称:DevOps,代码行数:25,代码来源:mail.py


注:本文中的html.HTML.table方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。