抱歉.我不想尝试任何火焰.我的脚本编写经验来自Perl,我是
Python的新手.
我只是想检查一下我是否可以像Python一样具有相同程度的灵活性.
在Python中:
page = form.getvalue("page") str = 'This is string : ' + str(int(page) + 1)
在Perl中:
$str = 'This is string : ' . ($page + 1);
有什么方法可以避免int / str转换吗?
解决方法
不,因为Python是强类型的.如果将页面保留为int,则可以执行以下操作:
s = 'This is string : %d' % (page + 1,)