Can json.dumps create multiple lines

Cecil Westerhof Cecil at decebal.nl
Thu Dec 1 11:30:31 EST 2016


I started to use json.dumps to put things in a SQLite database. But I
think it would be handy when it would be easy to change the values
manually.

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?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof



More information about the Python-list mailing list