One , Introduce

QQ Communication group :585499566

The purpose of this article is how to use Pyh+Bootstrap Fast generation of simplicity , generous , Fresh Html page , The skills involved :Python Xiaobai skills ,Pyh Can read Chinese documents ,Html Basics ,Bootstrap Can read and understand Chinese documents

Python: Certainly Python3 了 ...

Pyh: It's the great God https://code.google.com/p/pyh/wiki/UserManual  Make , You need a connection agent to view it , Fortunately, someone did the translation :https://www.jianshu.com/p/dc2ddd8e80cc
In the translation link , There are specific usage descriptions , There is no introduction here

Function is introduced :

  • Auto format HTML label
  • Highly customizable
  • Fully recognize CSS and Javascript
  • Auto close tag
  • Object oriented HTML Compiling mode

Html: Can find this article , I must know how to use it HTML Code , In order to prevent “ The small white ” I don't know what to do when I see this article , Just stick the accepted HTML Reference website w3school:http://www.w3school.com.cn/tags/tag_html.asp

Bootstrap: yes css,js frame , Can beautify the page , take “ a very ugly person ” become “ beautiful girl ”, ha-ha ... This is the Chinese address , Suggest using 3:https://v3.bootcss.com/

Here, let's see “ a very ugly person ” And “ beautiful girl ” Comparison of :

Has it become a lot more beautiful , ah , You say it's not very beautiful , Want to be “ Xi Shi ”, Then you need to help it make up again ...... It seems to prove : There are no ugly women in the world , Only lazy women

Two 、 Practice

Say more , Without the code , It's just being a hoodlum. , Delay the reader's time , Waste other people's youth

 #!/usr/bin/env python
# -*- coding:utf-8 -*- from pyh import * page = PyH(' Interface test report ') # First step : You need to have a title HTML Templates
page.addCSS('https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css') # The second step : We need to load the Bootstrap Templates css file , It can also be loaded if necessary js
Container = page << body(id='Body', cl='bg-warning') << div(id="container",cl="container") # The third step : Through the shift symbol “<<”, To generate the tag ;“<<” The left side must eventually be page # Report title start
Headrow = Container << div(id="Headrow", cl="row")
Headrow << h1(id="HeadH1",align="center") << strong("API_AutoTest_Report ",id="HeadTxt") + small("Sonny.zhang", id="author")
Headrow << br()
# Report title end # Data statistics start
Totalrow = Container << div(id="Totalrow", cl="Totalrow") << div(cl="jumbotron")
# -- Test usage time , Total number of test cases --
test_time_txt = [" Total test time :", "0:00:04.307585"]
case_num = [" The total number of cases :", ""]
UTimerow = Totalrow << div(id="UTimerow", cl="row")
UTimerow << div(cl="col-xs-12 col-md-6") << p(role="presentation") << span(test_time_txt[0]) << span(test_time_txt[1], cl="label label-default")
UTimerow << div(cl="col-xs-12 col-md-6") << p(role="presentation") << span(case_num[0]) << span(case_num[1],cl="label label-primary")
# -- Use case failure success Statistics --
Num1_txt = [" Number of successful use cases (Pass):", ""]
Num2_txt = [" Number of failed cases (Fail):", ""]
Num3_txt = [" Number of error cases (Error):", ""]
Num4_txt = [" Number of unexecuted cases (Block):", ""]
Amountrow = Totalrow << div(id="Amountrow", cl="row")
Num1 = Amountrow << div(id="Num1", cl="col-xs-12 col-md-3") << p(role="presentation") << span() << small(Num1_txt[0]) << span(Num1_txt[1], cl="label label-success")
Num2 = Amountrow << div(id="Num2", cl="col-xs-12 col-md-3") << p(role="presentation") << span() << small(Num2_txt[0]) << span(Num2_txt[1], cl="label label-danger")
Num3 = Amountrow << div(id="Num3", cl="col-xs-12 col-md-3") << p(role="presentation") << span() << small(Num3_txt[0]) << span(Num3_txt[1], cl="label label-warning")
Num4 = Amountrow << div(id="Num4", cl="col-xs-12 col-md-3") << p(role="presentation") << span() << small(Num4_txt[0]) << span(Num4_txt[1], cl="label label-default")
# Data statistics end # test plan start
Plans = Container << div(id="plans", cl="row")
# -- Column title --
plans_title = " Test case summary "
PlansTitle = Plans << div(id="plans-title", cl="panel panel-primary") << div(cl="panel-heading") << strong() << center(plans_title, cl="text-uppercase") # -- A test plan -- start
Plan1 = Plans << div(id="plan1", cl="col-xs-12 col-md-12") << table(cl="table table-striped")
# --- A title --
plan1_title = " test plan 【 Project name :APItest, Project name :user_operation】"
Plan1 << center() << caption(plan1_title)
# -- A list of --
# Header
thead1 = ["ID", " Execution number ", " Use cases ID", " Use the exception section ID", " Use case name ", " Use case suite ", " Execution results ", " The elapsed time "]
Thead1 = Plan1 << thead()
Thead1 << tr() << th(thead1[0]) + th(thead1[1]) + th(thead1[2]) + th(thead1[3]) + th(thead1[4]) + th(thead1[5]) + th(thead1[6]) + th(thead1[7])
# Body
tbody1 = ["", "", "", "APItest-1", " obtain token", " obtain token", "Pass", "2018-08-04 11:09:24"]
Error = "Error"
Tbody1 = Plan1 << tbody()
Tbody1 << tr() << th(tbody1[0], scope="row") + td(tbody1[1]) + td(tbody1[2]) + td(tbody1[3]) + td(tbody1[4]) + td(tbody1[5]) + td(tbody1[6]) + td(tbody1[7])
Tbody1 << tr() << th(tbody1[0], scope="row") + td(tbody1[1]) + td(tbody1[2]) + td(tbody1[3]) + td(tbody1[4]) + td(tbody1[5]) + td(p(Error, cl="label label-danger")) + td(tbody1[7])
# -- A test plan -- end
# test plan end # The test case start
Cases = Container << div(cl="row")
# -- Column title --
cases_title = " Use case execution details "
CasesTitle = Cases << div(cl="panel panel-primary") << div(cl="panel-heading") << strong(center(cases_title, cl="text-uppercase"))
# -- A test case -- start
Case1 = Cases << div(cl="col-xs-12 col-md-12") << table(cl="table table-striped")
# --- A title --
Case1_title = " test plan 【 Project name :APItest, Project name :user_operation】"
Case1 << center() << caption(plan1_title)
# -- A list of --
# Header
thead1 = ["ID", " Execution number ", " Use cases ID", " Use the exception section ID", " Use case name ", " Use case suite ", " Execution results ", " The elapsed time "]
Case1Thead1 = Case1 << thead()
Case1Thead1 << tr() << th(thead1[0]) + th(thead1[1]) + th(thead1[2]) + th(thead1[3]) + th(thead1[4]) + th(thead1[5]) + th(thead1[6]) + th(thead1[7])
# Body
tbody1 = ["", "", "", "APItest-1", " obtain token", " obtain token", "Pass", "2018-08-04 11:09:24"]
Error = "Error"
Case1Tbody1 = Case1 << tbody()
Case1Tbody1 << tr() << th(tbody1[0], scope="row") + td(tbody1[1]) + td(tbody1[2]) + td(tbody1[3]) + td(tbody1[4]) + td(tbody1[5]) + td(tbody1[6]) + td(tbody1[7])
Case1Tbody1 << tr() << th(tbody1[0], scope="row") + td(tbody1[1]) + td(tbody1[2]) + td(tbody1[3]) + td(tbody1[4]) + td(tbody1[5]) + td(p(Error, cl="label label-danger")) + td(tbody1[7])
# -- A test plan -- end
# test plan end page.printOut('Pyh_Template.html')

I've commented in the code Pyh Key points of using :“<<”, Any more questions , We can add groups to solve it , communication

<1>Python Generate high quality Html file :Pyh modular +Bootstrap More articles on Framework

  1. C# Shrinkage 、 Intercept 、 Class that merges images and generates high quality new images

    original text :C# Shrinkage . Intercept . Class that merges images and generates high quality new images using System;using System.Drawing;using System.Drawing.Imaging;using Syste ...

  2. atitit.thumb Generate high quality thumbnails php .net c++ java

    atitit.java thumb Generate high quality thumbnails  php .net c++ 1.  Image zoom (image scaling)--- Smoothness (smoothness) And clarity (sharpness) 1 2.  ...

  3. Effective Python Write high quality Python Code 59 Effective methods

    Effective Python Write high quality Python Code 59 Effective methods

  4. C# Clipping produces high quality zoom images

    /// <summary> /// High quality zoom images /// </summary> /// <param name="OriginFilePath"&g ...

  5. 【Python Music sequence generation of image features 】 Use Python Generate simple MIDI file

    This brand new Python Music Series , Will be updated from time to time . The original intention of writing this series , To do a project < Music sequence generation model based on image features >, Real time extraction of Photo Features , Neural network processing , Make a piece of music . A journey , ...

  6. Highcharts combination PhantomJS Generate high quality charts and pictures on the server side

    Project background Recently, I am busy developing a set of interactive report system for the Department , To replace the original static report system . The old system is based on dotnetCHARTING Developed ,dotnetCHARTING The advantage is that there are many types of charts , Interface call is simple , Just use ...

  7. python Generate executable exe file

    Why build an executable There is no need to install the corresponding programming environment You can shut down your application Users can easily . Quick direct use Packaging tools pyinstaller install pyinstaller pip install pyinsta ...

  8. MPlayer-ww Add the function of cutting while watching + Generate high quality GIF function

    http://pan.baidu.com/s/1eQm5a74 download FFmpeg palettegen paletteuse documentation Need to download FFmpeg2.6 above and FFmp ...

  9. python Generate 1900-2100 The 24 solar terms document of

    [ Learning notes ] Reprint #!/usr/bin/python3.7# -*- coding:utf-8 -*- ''' The whole idea 1: Calculate the solar term date according to the formula 1900 Year to 2100  200 Years of time 2: special ...

Random recommendation

  1. Web APi The creation process and principle analysis of the controller ( 8、 ... and )

    Preface The Mid Autumn Festival has a rest , From time to time on the way to see the principle of creating controller and Analysis , It took a long time , It's just that there's more than enough food but less power , But I thought that since I promised to finish a series of principles , There's a beginning and an end to it . Don't talk nonsense , Go straight to the topic . HttpContro ...

  2. viewpager Accept value image rotation

    package com.baway.test; import java.util.ArrayList;import java.util.List;import java.util.Timer;impo ...

  3. WPF: Gets the child in the control

    One . Content of the interface ( part : For reference only ) <Window> <Window.Resources> <!-- Tool data sources --> <XmlDataProvider x:Key ...

  4. DAM The use of a combination of serial port and interrupt as well as GPIO.

    DAM The use of a combination of serial port and interrupt as well as GPIO. When I learned DMA This Chapter means that I have finished ,GPIO Inside LED, Key , There is also the serial port to send data . Now let's sum up what we learned some time ago ( Because I don't have time to ...

  5. Lenovo official OEM Partition production

    today , My friend bought a new Lenovo computer , It comes with a factory system . Get into PE Later, I found that Lenovo's official OEM Partition , So I copied it directly , And then it's installed in another computer and it's working properly , Let me share with you . Project Download :         link :ht ...

  6. Vue Easy to get started , Learn together !

    We create a project , Let's talk about this project in detail Vue. One . How to add modules to a project We go through npm Conduct install modular . First we pass cmd.exe cd Go to your project root , There must be package.json file , install ...

  7. appium+python3+pycharm Step on the pit 2

    Not quite. I just solved the last mistake , This will be solved immediately : selenium.common.exceptions.WebDriverException: Message: A new session could n ...

  8. MySQL Binlog Detailed explanation

    MySQL Binlog Detailed explanation Mysql Of binlog Log is used to record mysql Internal addition, deletion, modification, check, etc mysql The database has a record of the updated content ( Changes to the database ), Queries to the database select or show Wait, it won't be bi ...

  9. python Lesson 40 —— Constructors

    1. Adding properties to objects dynamically : After the object is created , Add the required properties to it separately : It can be understood as : Personal Tailor [ Be careful ]: Only this object can use the added property , If other objects are used , Direct error ; 2. Constructors / Construction method / Constructors : Format ...

  10. Recommend a few good h5 The game engine

    http://www.phaser.io/examples http://www.cocos.com/ http://cn.cocos2d-x.org/tutorial/lists?id=30 coc ...