python3 TypeError: can only concatenate str (not "dict") to str

问题代码:

url = 'http://localhost:84/#/admin/login'
data = {}
data['account'] = '123'
data['password'] = '123123123.'
# 将数据和url进行连接
request = url+'?'+data

问题原因:类型不兼容,不能强制组合

解决方案:

url = 'http://localhost:84/#/admin/login'
data = {}
data['account'] = '123'
data['password'] = '123123123.'
# 将数据和url进行连接
request = url+'?'+str(data)

 

你可能感兴趣的:(python)