[PYTHON] Display serial number columns and variables with Bottle template

How to display serial number columns and variables in Bottle template

Sample class

class Sample(object):
    def __init__(self):
        self.val_1 = 1
        self.val_2 = 2
        self.val_3 = 3
        self.val_4 = 4
        self.val_5 = 5
        self.val_6 = 6
        self.val_7 = 7
        self.val_8 = 8
        self.val_9 = 9
        self.val_10 = 10

template

% for i in range(1, 11):
    {{ sample.__dict__['val_' + str(i)] }}
% end

Recommended Posts

Display serial number columns and variables with Bottle template
Template for Bottle when deploying with Github and Bitbucket
Calculate and display standard weight with python
Import serial number videos together with Aviutl
Web scraping with BeautifulSoup4 (serial number page)
Connect Scratch X and Digispark with a bottle
Display Google Maps API with Rails and pin display
Erase & generate serial number files with shell script
Interactively display algebraic curves with Python and Jupyter
Wrap and display Japanese sentences well with pyglet
Trouble with Python pseudo-private variables and class inheritance
Template network config generation with Python and Jinja2
Display and analyze only some columns in CASTable