0
dict = {1:'a','1':'b'}

{{1}} or {{'1'}} should give 'a' and 'b' respectively but it's not working in any case. is it valid or should use only alphabets for keys?

because I want to make multiplication table for entered number in textbox like for 2

2 x 1 = 2 
2 x 2 = 4 
.
.
.

2 x 9 =18
2 x 10 = 20

1 Answers1

0

A quick google search reveals that to access

mydict = {"key1":"value1", "key2":"value2"}

you must do

{{ mydict.key1 }}, {{ mydict.key2 }}

So to access the key 1, you would do:

{{dict.1}}

Note that using the dict as your variable name shadows the keyword dict and is something you should avoid.

sortBot
  • 16
  • 3