尝试实现QMEAN时出现Python缩进错误

时间:2018-10-18 07:04:54

标签: python json python-3.x indentation

import json
import requests
url = "https://swissmodel.expasy.org/qmean/submit/"
# To upload from URL, put the URL as the structure
response = requests.post(url=url, data={"structure": 
"https://files.rcsb.org/download/1CRN.pdb", "email": "your@email.com"})

# When using Python requests - to upload from file, put the file in files
response = requests.post(url=url, data={"email": "your@email.com"}, files= 
{"structure": open('my_structure.pdb','r')}) 
print json.dumps(response.json(), indent=4, sort_keys=True)
{
"download_url": "https://swissmodel.expasy.org/qmean/qH7VxZ.json",
"error": "",
"meta": {
    "created": "2016-08-31 10:26:13.128564",
    "email": "your@email.com",
    "project_name": "Project",
    "results_page": "https://swissmodel.expasy.org/qmean/project/qH7VxZ/",
    "seqres_uploaded": false
},
"method": "QMEANDisCo",
"models": [
    {
        "modelid": "model_001",
        "name": "1CRN.pdb",
        "seqres": [
            {
                "atomseq": "TTCCPSIVARSNFNVCRLPGTPEAICATYTGCIIIPGATCPGDYAN",
                "chain_name": "A",
                "name": "seq_chain_0",
                "sequence": "TTCCPSIVARSNFNVCRLPGTPEAICATYTGCIIIPGATCPGDYAN"
            }
        ]
    }

我收到以下错误消息:

  

打印json.dumps(response.json(),indent = 4,sort_keys = True)   IndentationError:意外缩进

实际上,这是一个简单的缩进错误,我该如何解决?

0 个答案:

没有答案