May
02

break the long line in python

There are several methods to break the long string line in python. I think the triple-quoted “”” method is the easiest way. The reason is you can also for json object.

myJson =””” {
“result”:
[{“short_description”: “I am getting bluescreen error”,
“sys_id”: “39b5f8c2376ede007520021a54990e5c”,
“opened_at”: “2016-04-04 05:19:53”,
“number”:”INC0258523″
},
{
“short_description”: “laptop crashed with a blue screen”,
“sys_id”: “da0095380f43d200a4f941fce1050eeb”,
“opened_at”:”2016-04-25 06:33:52″,
“number”:”INC0259067″
},
{
“short_description”: “Laptop not booting”,
“sys_id”: “ecf9c9b00f43d200a4f941fce1050e17”,
“opened_at”: “2016-04-25 06:07:16”,
“number”: “INC0259061”
}]
}
“””
data = json.loads(myJson)

It works!

Written by connygy. Posted in python

Trackback from your site.

Leave a comment