LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 09: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, 09: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



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 01:48 PM
Python, find unique values in a tuple or dictionary action_owl Programming 2 05-11-2010 07:16 PM
printing a string that unfolds with Python xadrith Programming 4 07-23-2008 01:13 PM
convert string to integer with python Kanaflloric Programming 2 05-27-2005 11:04 AM
python; retrieving dictionary of ley=value pairs passed into method TheLinuxDuck Programming 5 08-21-2003 11:56 AM

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

All times are GMT -5. The time now is 09:59 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
Open Source Consulting | Domain Registration