remove quotes from output of python dictionaries

2739 views python
5

I am new to python and I am stuck in a situation here! I have stored strings in a python dictionary and when I try to extract it python is wrapping single quotes around the value and giving it back. How can I get rid of the single quotes?

Example code:

myDict = {"name":"Rosy", "class":"9", "likes":"cakes"}
myDict.get("name")

Output: 'Rosy' Desired output: Rosy

answered question

1 Answer

9

I think you probably just want to:

print(myDict.get("name"))

posted this

Have an answer?

JD

Please login first before posting an answer.