TypeError("'functools.partial' object is not iterable",) in python, bottle.py
TypeError("'functools.partial' object is not iterable",) in python, bottle.py
下面是我的代码,去掉了导致错误的原因。
我正在尝试使用 python 和 bottle 框架。
尝试启动本地主机时,我收到此错误消息,指出 functools.partial 不可迭代。
帮助?
我的html代码。
<!DOCTYPE html>
<html>
<head>
<title>Home Page</title>
</head>
<body>
<section>
<ul>
%for i in include:
<li>{{i}}</li>
%end
</ul>
</section>
</body>
</html>
我的瓶子代码。
import bottle
@bottle.route('/')
def home_page():
__include = ['Uppercase characters', 'Lowercase characters', 'Symbols', 'Numbers']
return bottle.template('template', {'include' : __include})
bottle.debug(True)
bottle.run(host='localhost', port=8080)
不要叫它"include" - 它由 SimpleTemplate
保留
重命名即可
@bottle.route('/')
def home_page():
include = ['Uppercase characters', 'Lowercase characters', 'Symbols', 'Numbers']
return bottle.template('template', {'include_or_other_name' : include})
HTML
<!DOCTYPE html>
<html>
<head>
<title>Home Page</title>
</head>
<body>
<section>
<ul>
%for i in include_or_other_name:
<li>{{i}}</li>
%end
</ul>
</section>
</body>
</html>
下面是我的代码,去掉了导致错误的原因。 我正在尝试使用 python 和 bottle 框架。 尝试启动本地主机时,我收到此错误消息,指出 functools.partial 不可迭代。 帮助?
我的html代码。
<!DOCTYPE html>
<html>
<head>
<title>Home Page</title>
</head>
<body>
<section>
<ul>
%for i in include:
<li>{{i}}</li>
%end
</ul>
</section>
</body>
</html>
我的瓶子代码。
import bottle
@bottle.route('/')
def home_page():
__include = ['Uppercase characters', 'Lowercase characters', 'Symbols', 'Numbers']
return bottle.template('template', {'include' : __include})
bottle.debug(True)
bottle.run(host='localhost', port=8080)
不要叫它"include" - 它由 SimpleTemplate
保留重命名即可
@bottle.route('/')
def home_page():
include = ['Uppercase characters', 'Lowercase characters', 'Symbols', 'Numbers']
return bottle.template('template', {'include_or_other_name' : include})
HTML
<!DOCTYPE html>
<html>
<head>
<title>Home Page</title>
</head>
<body>
<section>
<ul>
%for i in include_or_other_name:
<li>{{i}}</li>
%end
</ul>
</section>
</body>
</html>