servertime = int(time.time())
dada_data='{"city_name": "苏州市", "city_id": 5, "iss_type": "dada", "servertime": %s, "basefee": [["0-1公里(含1公里)", "/", "8.0元(起步价)"], ["1.0-3.0公里(含3.0公里)", "1公里", "+1.0元"], ["3.0-20.0公里(含20.0公里)", "1公里", "+2.0元"], ["20.0公里以上", "3公里", "+5.0元"], "special_person_fee": [{"text": "整单+0.0元"}, {"begin": "0", "end": "2", "percent": "40", "text": "0-2公里(含2公里)+40%"}, {"begin": "2", "end": "4", "percent": "30", "text": "2-4公里(含4公里)+30%"}, {"begin": "4", "end": "13", "percent": "20", "text": "4-13公里(含13公里)+20%"}, {"begin": "13", "end": "-1", "percent": "15", "text": "13公里以上+15%"}], "overweight_fee": [["0-5公斤(含5公斤)", "/", "不收费"], ["5.0-50.0公斤(含50.0公斤)", "1公斤", "+2.0元"], ["50.0公斤以上", "1公斤", "+0.0元"]], "night_fee": [["00:00~07:00", "+8.0元"], ["22:00~23:59", "+4.0元"]], "电动车": "+0元", "轿车": "+4.0元"}'%(str(servertime))
报错如下
TypeError: not enough arguments for format string
因为你内容中还有多个
%
,需要转义为%%
。