LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 03-17-2011, 10:48 PM   #1
aarsh
Member
 
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
aarsh
Member
 
Registered: Mar 2010
Location: USA
Distribution: Ubuntu MATE
Posts: 182

Original Poster
Rep: Reputation: 18
SOLVED :

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'}"
 
  


Reply


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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

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