LoginSignup
2
2

More than 5 years have passed since last update.

連番のカラム、変数をBottleのテンプレートで表示する

Last updated at Posted at 2016-06-30

連番のカラムや変数をBottleのテンプレートで表示する方法

サンプルクラス

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

テンプレート

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

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2