Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7951299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:31:10+00:00 2026-06-04T02:31:10+00:00

This is basic python script that parses a string and retrieves parameters and their

  • 0

This is basic python script that parses a string and retrieves parameters and their values.

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

The issue here is that the hashtable filters never gets these values. The output of this script is

{'false': []}

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:31:11+00:00Added an answer on June 4, 2026 at 2:31 am

    You’re recreating filters inside the loop:

    filters = {}
    

    This line needs to be placed before the loop, not inside.

    Another potential issue is that your input contains duplicate keys (fdim_y and idim). As things stand, your code only keep the last value of each key.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very basic python script that does HTTP connection. import socket def
I wrote a basic Hippity Hop program in C, Python, and OCaml. Granted, this
Hi I have this basic random quote script, but I would like it to
I'm trying to learn this basic thing about processors that should be taught in
I'd like to create a small script that basically does this: run program1.exe -->
I have a python script that runs continuously. It outputs 2 lines of info
So, here's the deal. I am attempting to write a quick python script that
This is probably a truly basic thing that I'm simply having an odd time
I have a python script that works great when run by itself. Based on
If I have a basic Python script, with it's hashbang and what-not in place,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.