我试图执行此操作:
# the request send a number and its ok, the variable have good informations.
test = request.POST[member.user.username]
# SyntaxError at ***here***, can't assign to operator
group%d % test = member.user.username
我也试过了:
test = request.POST[member.user.username]
group%d = member.user.username % test
并且:
test = request.POST[member.user.username]
group%d = member.user.username % (test)
对语法有什么想法?
答案 0 :(得分:0)
您可以使用字典来执行此操作:
test = request.POST[member.user.username]
d={}
d['group'+str(test)]= member.user.username
也许,有更好的方法,但我只知道这一个。