Answers for "print( str in dictionary) python"

0

python dict keys to string

myList = ['Tom', 'Lisa', 'Chris', 'Joe']
separator = ' and ' # note the spaces around

s = separator.join(myList)

print(s)

## outputs:
## Tom and Lisa and Chris and Joe
Posted by: Guest on August-16-2020
0

python get ppretty string representaiton of dictinary

from pprint import pformat

# Sufficiently large to make newline character in new format
d = {"a": {'b': [1, 2, 3]}, "c": [4, 5], 'd': {'e': {'f': [6, 7, 8]},
     'g': [9, 10]}, 'h': 11, 'i': 12}
pformat(d)
Posted by: Guest on September-09-2020

Code answers related to "print( str in dictionary) python"

Python Answers by Framework

Browse Popular Code Answers by Language