如何使用mod_wsgi和Bottle在Web浏览器中输出int类型?

时间:2017-05-25 02:07:37

标签: python bottle

对于字符串,它是输出

from bottle import route

@route('/')
def index():
    return '4'

如果是int,则不输出

·为什么?

from bottle import route

@route('/')
def index():
    return 4

环境

·Python 3.6

·bottel 0.13

·铬

1 个答案:

答案 0 :(得分:0)

代码没有问题

from bottle import route

@route('/')
def index():
    return '4'

@route('/')
def index2():
    return 4

print("type of ", index()," is ", type(index()))
print("type of ", index2()," is ", type(index2()))

我得到了那个结果:

type of  4  is  <class 'str'>
type of  4  is  <class 'int'>
相关问题