On 2016-12-01 17:30, Cecil Westerhof wrote: > When I have a value dummy which contains: > ['An array', 'with several strings', 'as a demo'] > Then json.dumps(dummy) would generate: > '["An array", "with several strings", "as a demo"]' > I would prefer when it would generate: > '[ > "An array", > "with several strings", > "as a demo" > ]' > > Is this possible, or do I have to code this myself?
print(json.dumps(['An array', 'with several strings', 'as a demo'], indent=0)) for the basics of what you ask, though you can change indent= to indent the contents for readability. -tkc -- https://mail.python.org/mailman/listinfo/python-list