これは、文字列を解析し、パラメータとその値を取得する基本的なPythonスクリプトです。
import re
link = "met_y=population&fdim_y=patientStatus:7&fdim_y=pregnant:1&scale_y=lin&ind_y=false&rdim=department&idim=department:9:2:4&idim=clinic:93301:91100:93401:41201:41100&ifdim=department&tstart=1190617200000&tend=1220511600000&ind=false&draft"
print link
filters = ''
matches = re.findall("\&?(?P<name>\w+)=(?P<value>(\w|:)+)\&?",link )
for match in matches:
name = match[0]
value = match[1]
selection = value.split(':')
filters = {}
print selection[0]
print selection[1:len(selection)]
filters[selection[0]] = selection[1:len(selection)]
print filters
ここでの問題は、ハッシュテーブルフィルターがこれらの値を取得しないことです。このスクリプトの出力は次のとおりです。
{'false': []}
私は何が間違っているのですか?