有人可以建议我如何在Python中或通过命令行美化JSON?
唯一可以做到这一点的基于在线的JSON美化器是:http://jsonviewer.stack.hu/.
但是,我需要在Python中使用它.
这是我的数据集:
{ "head": {"vars": [ "address" , "description" ,"listprice" ]} , "results": { "bindings": [
{
"address" : { "type":"string", "value" : " Dyne Road, London NW6"},
"description" :{ "type":"string", "value" : "6 bed semi detached house"},
"listprice" : { "type":"string", "value" : "1,150,000"}
}
,
{
"address" : { "type":"string", "value" : " Tweedy Road, Bromley BR1"},
"description" :{ "type":"string", "value" : "5 bed terraced house"},
"listprice" : { "type":"string", "value" : …Run Code Online (Sandbox Code Playgroud) 我需要将oracle表导出为csv/excel文件格式(以及列标题).通过cx_oracle或通过sqlplus欢迎的解决方案.
评论中的Python代码:
con = cx.connect()
cur = con.cursor()
printer = cur.execute(sqlcode)
con.commit()
Run Code Online (Sandbox Code Playgroud) 我是cx_oracle的新手.我已建立连接,我可以使用execute创建和删除表.
我失败的地方是当我尝试在执行中使用"INSERT INTO ..."时.它没有显示任何错误,但它也没有存储任何值(我通过检查条目是否使用shell中的sqlplus进行确认).我使用的代码是:
table_name = "T1"
column = "D"
insert_value = "test value"
sqlcode = "INSERT INTO "+table_name+" ("+column+") VALUES ('"+insert_value+"')"
cursor.execute(sqlcode)
Run Code Online (Sandbox Code Playgroud)
请帮助我,任何帮助将不胜感激.
提前致谢.Ĵ