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 876961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:31:29+00:00 2026-05-15T11:31:29+00:00

I have a list of python dictionaries that look like this: sandwiches = [

  • 0

I have a list of python dictionaries that look like this:

sandwiches = [
    {'bread':'wheat', 'topping':'tomatoes', 'meat':'bacon'},
    {'bread':'white', 'topping':'peanut butter', 'meat':'bacon'},
    {'bread':'sourdough', 'topping':'cheese', 'meat':'bacon'}
]

I want to pass this as a POST parameter to another Django app. What does the client app need to do to iterate through the list?

I want to do something like:

for sandwich in request.POST['sandwiches']:
    print "%s on %s with %s is yummy!" % (sandwich['meat'], sandwich['bread'], sandwich['topping'])

But I don’t seem to have a list of dicts when my data arrives at my client app.

  • 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-05-15T11:31:29+00:00Added an answer on May 15, 2026 at 11:31 am

    You don’t say how you’re POSTing to the app. My advice would be to serialize the dictionaries as JSON, then simply POST that.

    import json, urllib, urllib2
    data = json.dumps(sandwiches)
    urllib2.urlopen(myurl, urllib.urlencode({'data': data}))
    

    … and on the receiver:

    data = request.POST['data']
    sandwiches = json.loads(data)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a python list that looks like this example: [[' 1', ' 200',
Let's say I have a Python list that looks like this: list = [
In Python, I've got a list of dictionaries that looks like this: matchings =
I have a list of dictionaries like that : [ {'item1':'bla', 'item2':'bli', 'item3':'blu'}, {'item1':'love',
I have a Python list that I'm supplying to the template: {'error_name':'Please enter a
I have passed Python list to template like l=['text','there is no salary','I need alcohol','and
Here is my problem: I have a list of Python dictionaries of identical form,
In Python, I have a list of dictionaries: mylist = [ { 'name': 'James',
I have python list like below. lst = ['paragraph 1','paragraph 2','paragraph 3'] I'm trying
If I have a list in Python like [1, 2, 2, 2, 2, 1,

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.