Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-17-2011, 10:48 PM   #1
Registered: Mar 2010
Location: USA
Distribution: Ubuntu MATE
Posts: 182

Rep: Reputation: 18
Python : Dictionary to String

how to convert a dictionary data-type to a string ?

actually I am trying to update some json file 's dictionary.

please help... I am on nerve of getting some-stuff done !
Old 03-17-2011, 10:51 PM   #2
Registered: Mar 2010
Location: USA
Distribution: Ubuntu MATE
Posts: 182

Original Poster
Rep: Reputation: 18

it's as simple as 1 2 3 !

>>> d
{'a': 'apple', 'c': 'chocolates', 'b': 'book', 'd': 'dummy'}
>>> s=str(d)
>>> s
"{'a': 'aarsh', 'c': 'chocolates', 'b': 'book', 'd': 'dummy'}"


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Python: Create variables from dictionary keys danubuntuman Programming 5 01-31-2011 02:48 PM
Python, find unique values in a tuple or dictionary action_owl Programming 2 05-11-2010 08:16 PM
printing a string that unfolds with Python xadrith Programming 4 07-23-2008 02:13 PM
convert string to integer with python Kanaflloric Programming 2 05-27-2005 12:04 PM
python; retrieving dictionary of ley=value pairs passed into method TheLinuxDuck Programming 5 08-21-2003 12:56 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:52 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration