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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:51:45+00:00 2026-05-20T15:51:45+00:00

Django query gives me below output format,but i want below format data=`[{‘total’: 1744, ‘name:

  • 0

Django query gives me below output format,but i want below format

data=`[{'total': 1744, 'name: u'x'}, {'total': 13, 'name': u'm'}, {'total': 126, 'role': name'n'}]`
m=[]
for i in data:
   m.append(i.values())

print m
it give me output

[[1744,u'x'], [13,u'm'], [126,u'n']]

but i need output in
how to remove unicode symbol from output

[['x',1744], ['m',13], ['n',126]]

how to do this ?

Thanks in advance

  • 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-20T15:51:46+00:00Added an answer on May 20, 2026 at 3:51 pm

    Try this:

    >>> import json
    >>> data=[{'total': 1744, 'name': u'x'}, {'total': 13, 'name': u'm'}, {'total': 126, 'name': u'n'}]
    >>> json.dumps([i.values()[::-1] for i in data])
    '[["x", 1744], ["m", 13], ["n", 126]]'
    >>> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I query on the full name in Django? To clarify, I essentially
is there a way to do the following in one Django query? MyModel.filter(attr=a).values('attr','fields','of','interest').annotate(count=Count('id')) MyModel.filter(attr=b).values('attr','fields','of','interest').annotate(count=Count('id'))
I am having trouble getting a Django ORM query to work correctly. I have
I need some help putting together this query in Django. I've simplified the example
this is my first question. I'm trying to execute a SQL query in django
In django how to check whether any entry exists for a query sc=scorm.objects.filter(Header__id=qp.id) This
I have a query that I'm trying to figure the django way of doing
Updated question: Django is giving me the following sql query: SELECT auth_user.id, auth_user.username, auth_user.first_name,
How can I order by descending my query set in django by date? Reserved.objects.all().filter(client=client_id).order_by('check_in')
I'm strugling with a complex query that I cannot translate into the django orm.

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.