简体   繁体   English

AttributeError:'list'对象没有属性'replace'

[英]AttributeError: 'list' object has no attribute 'replace'

I am running into below error with the below piece of code,can any one provide suggestions on how to fix it? 我正在使用下面的代码遇到以下错误,任何人都可以提供有关如何修复它的建议吗?

import json
gerritinfo=['{"project":"platform/frameworks/opt/telephony","branch":"kitkat","id":"Idcf6faee0f6259704ea07b62ce713ebdd4c5da1b","number":"739919","subject":"Correct order of parameter in iccExchangeApdu()","owner":{"name":"Satish Kumar Singh","email":"c_ssing@qca.qualcomm.com","username":"c_ssing"},"url":"https://review-android.quicinc.com/739919","createdOn":1399412660,"lastUpdated":1399437231,"sortKey":"002cea91000b4a4f","open":true,"status":"NEW","comments":[{"timestamp":1399412661,"reviewer":{"name":"Gator Service Account","email":"gator@localhost","username":"gator"},"message":"Patch Set 1: Looks good to me, but someone else must approve\\n\\nThis patchset has been processed by the Gator."},{"timestamp":1399412704,"reviewer":{"name":"Checkpatch Service Account","email":"checkpatch@localhost","username":"checkpatch"},"message":"Patch Set 1: Looks good to me, but someone else must approve\\n\\nYour change has passed all of the checks enforced by the android patchchecker."},{"timestamp":1399413456,"reviewer":{"name":"Satish Kumar Singh","email":"c_ssing@qca.qualcomm.com","username":"c_ssing"},"message":"Patch Set 1: Developer Build and Test Successful\\n\\n"},{"timestamp":1399415354,"reviewer":{"name":"Gueyoung Lee","email":"gueyoung@qca.qualcomm.com","username":"gueyoung"},"message":"Patch Set 1: Looks good to me, but someone else must approve\\n\\n"},{"timestamp":1399417092,"reviewer":{"name":"Dhananjai Singh","email":"dhananja@qca.qualcomm.com","username":"dhananja"},"message":"Patch Set 1: Looks good to me, but someone else must approve\\n\\n"},{"timestamp":1399417366,"reviewer":{"name":"David Ng","email":"dng@quicinc.com","username":"dng"},"message":"Patch Set 1: Looks good to me, approved\\n\\nI remembered the previous change went in recently.  How come this was not caught in the original testing as this would have failed right away?\\n\\nThanks!\\nDavid"},{"timestamp":1399418880,"reviewer":{"name":"Klocwork Automation User","email":"kwuser@localhost","username":"kwuser"},"message":"Patch Set 1:\\n\\nThis change is being verified in klocwork for the following manifests along with other changes as detailed below:\\n\\n\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\ngit-android.quicinc.com/platform/manifest:kk:default.xml\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\nhttps://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId\\u003d3217513\\n\\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------\\n\\n  o https://review-android.quicinc.com/#change,\\n\\n\\n\\nPlease note that verification of all changes in this batch need to be successful before this change can be merged.\\n\\nPLEASE DO NOT UPLOAD A NEW PATCH SET, OR REMOVE APPROVALS UNTIL THE VERIFICATION IS COMPLETE.\\n"},{"timestamp":1399418898,"reviewer":{"name":"Linux Build Service Account","email":"lnxbuild@localhost","username":"lnxbuild"},"message":"Patch Set 1:\\n\\nThis change is being verified in lookahead for the following manifests along with other changes as detailed below:\\n\\n\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\ngit-android.quicinc.com/platform/manifest:kk:default.xml\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\nhttps://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId\\u003d3217515\\n\\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------\\n\\n  o https://review-android.quicinc.com/#change,739919\\n\\n\\n\\nPlease note that verification of all changes in this batch need to be successful before this change can be merged.\\n\\nPLEASE DO NOT UPLOAD A NEW PATCH SET, OR REMOVE APPROVALS UNTIL THE VERIFICATION IS COMPLETE.\\n"},{"timestamp":1399418924,"reviewer":{"name":"Linux Build Service Account","email":"lnxbuild@localhost","username":"lnxbuild"},"message":"Patch Set 1:\\n\\nThis change is being verified in lookahead for the following manifests along with other changes as detailed below:\\n\\n\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\ngit-android.quicinc.com/platform/manifest:kk:default.xml\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\nhttps://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId\\u003d3217517\\n\\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------\\n\\n  o https://review-android.quicinc.com/#change,739919\\n\\n\\n\\nPlease note that verification of all changes in this batch need to be successful before this change can be merged.\\n\\nPLEASE DO NOT UPLOAD A NEW PATCH SET, OR REMOVE APPROVALS UNTIL THE VERIFICATION IS COMPLETE.\\n"},{"timestamp":1399422861,"reviewer":{"name":"Klocwork Automation User","email":"kwuser@localhost","username":"kwuser"},"message":"Patch Set 1: Verified\\n\\nSuccessful klocwork verification. You may find the results of the verification by following the link(s) below:\\n\\nhttps://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId\\u003d3217513\\n\\n"},{"timestamp":1399427087,"reviewer":{"name":"Linux Build Service Account","email":"lnxbuild@localhost","username":"lnxbuild"},"message":"Patch Set 1: Verified\\n\\nSuccessful lookahead verification. You may find the results of the verification by following the link(s) below:\\n\\nhttps://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId\\u003d3217515\\n\\n"},{"timestamp":1399427807,"reviewer":{"name":"Linux Build Service Account","email":"lnxbuild@localhost","username":"lnxbuild"},"message":"Patch Set 1:\\n\\nSuccessful lookahead verification. You may find the results of the verification by following the link(s) below:\\n\\nhttps://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId\\u003d3217517\\n\\n"},{"timestamp":1399428952,"reviewer":{"name":"PATCHSET LOCK CNSS GERRIT","email":"cgpl@localhost","username":"cgpl"},"message":"Patch Set 1: Patch Set Locked\\n\\n"},{"timestamp":1399433104,"reviewer":{"name":"Preflight Locking User","email":"preflight@localhost","username":"preflight"},"message":"Patch Set 1: Developer Build and Test Successful\\n\\nLocked for preflight"},{"timestamp":1399433250,"reviewer":{"name":"Linux Build Service Account","email":"lnxbuild@localhost","username":"lnxbuild"},"message":"Patch Set 1:\\n\\nThis change is being verified for the following manifests along with other changes as detailed below:\\n\\n\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\ngit-android.quicinc.com/platform/manifest:kk:default.xml\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\nhttps://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId\\u003d3219556\\n\\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------\\n\\n  o https://review-android.quicinc.com/#change,735646\\n\\n  o https://review-android.quicinc.com/#change,725038\\n\\n  o https://review-android.quicinc.com/#change,707889\\n\\n  o https://review-android.quicinc.com/#change,733482\\n\\n  o https://review-android.quicinc.com/#change,734797\\n\\n  o https://review-android.quicinc.com/#change,738976\\n\\n  o https://review-android.quicinc.com/#change,739919\\n\\n  o https://review-android.quicinc.com/#change,738249\\n\\n  o https://review-android.quicinc.com/#change,740118\\n\\n  o https://review-android.quicinc.com/#change,717048\\n\\n  o https://review-android.quicinc.com/#change,717049\\n\\n  o https://review-android.quicinc.com/#change,717050\\n\\n  o https://review-android.quicinc.com/#change,728537\\n\\n  o https://review-android.quicinc.com/#change,728778\\n\\n  o https://review-android.quicinc.com/#change,728784\\n\\n  o https://review-android.quicinc.com/#change,729018\\n\\n  o https://review-android.quicinc.com/#change,729147\\n\\n  o https://review-android.quicinc.com/#change,731124\\n\\n  o https://review-android.quicinc.com/#change,731160\\n\\n  o https://review-android.quicinc.com/#change,731551\\n\\n  o https://review-android.quicinc.com/#change,733219\\n\\n  o https://review-android.quicinc.com/#change,734250\\n\\n  o https://review-android.quicinc.com/#change,734472\\n\\n  o https://review-android.quicinc.com/#change,734487\\n\\n  o https://review-android.quicinc.com/#change,734503\\n\\n  o https://review-android.quicinc.com/#change,734889\\n\\n  o https://review-android.quicinc.com/#change,734923\\n\\n  o https://review-android.quicinc.com/#change,735244\\n\\n  o https://review-android.quicinc.com/#change,735559\\n\\n  o https://review-android.quicinc.com/#change,736352\\n\\n  o https://review-android.quicinc.com/#change,729385\\n\\n\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\ngit-android.quicinc.com/mdm/manifest:master:default.xml\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\nhttps://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId\\u003d3219555\\n\\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------\\n\\n  o https://review-android.quicinc.com/#change,725038\\n\\n  o https://review-android.quicinc.com/#change,707889\\n\\n  o https://review-android.quicinc.com/#change,738249\\n\\n  o https://review-android.quicinc.com/#change,740118\\n\\n  o https://review-android.quicinc.com/#change,717048\\n\\n  o https://review-android.quicinc.com/#change,717049\\n\\n  o https://review-android.quicinc.com/#change,717050\\n\\n  o https://review-android.quicinc.com/#change,729385\\n\\n\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\ngit-android.quicinc.com/platform/manifest:master_64:default.xml\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\nhttps://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId\\u003d3219557\\n\\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------\\n\\n  o https://review-android.quicinc.com/#change,735646\\n\\n  o https://review-android.quicinc.com/#change,725038\\n\\n  o https://review-android.quicinc.com/#change,707889\\n\\n  o https://review-android.quicinc.com/#change,733482\\n\\n  o https://review-android.quicinc.com/#change,734797\\n\\n  o https://review-android.quicinc.com/#change,738976\\n\\n  o https://review-android.quicinc.com/#change,738249\\n\\n  o https://review-android.quicinc.com/#change,740118\\n\\n  o https://review-android.quicinc.com/#change,717048\\n\\n  o https://review-android.quicinc.com/#change,717049\\n\\n  o https://review-android.quicinc.com/#change,717050\\n\\n  o https://review-android.quicinc.com/#change,729385\\n\\n\\n\\nPlease note that verification of all changes in this batch need to be successful before this change can be merged.\\n\\nPLEASE DO NOT UPLOAD A NEW PATCH SET, OR REMOVE APPROVALS UNTIL THE VERIFICATION IS COMPLETE.\\n"},{"timestamp":1399434561,"reviewer":{"name":"Preflight Locking User","email":"preflight@localhost","username":"preflight"},"message":"Patch Set 1: Not developer verified\\n\\nUnlocked"},{"timestamp":1399434591,"reviewer":{"name":"Linux Build Service Account","email":"lnxbuild@localhost","username":"lnxbuild"},"message":"Patch Set 1:\\n\\n\\nAborted verification due to sibling job failure as part of parallelverification. This change will get picked up in subsequent verification cycles. No action is needed.\\n\\n"},{"timestamp":1399435613,"reviewer":{"name":"Preflight Locking User","email":"preflight@localhost","username":"preflight"},"message":"Patch Set 1: Developer Build and Test Successful\\n\\nLocked for preflight"},{"timestamp":1399435770,"reviewer":{"name":"Linux Build Service Account","email":"lnxbuild@localhost","username":"lnxbuild"},"message":"Patch Set 1:\\n\\nThis change is being verified for the following manifests along with other changes as detailed below:\\n\\n\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\ngit-android.quicinc.com/platform/manifest:kk:default.xml\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\nhttps://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId\\u003d3219789\\n\\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------\\n\\n  o https://review-android.quicinc.com/#change,737413\\n\\n  o https://review-android.quicinc.com/#change,716076\\n\\n  o https://review-android.quicinc.com/#change,737755\\n\\n  o https://review-android.quicinc.com/#change,739365\\n\\n  o https://review-android.quicinc.com/#change,703116\\n\\n  o https://review-android.quicinc.com/#change,728537\\n\\n  o https://review-android.quicinc.com/#change,728778\\n\\n  o https://review-android.quicinc.com/#change,728784\\n\\n  o https://review-android.quicinc.com/#change,729018\\n\\n  o https://review-android.quicinc.com/#change,729147\\n\\n  o https://review-android.quicinc.com/#change,731124\\n\\n  o https://review-android.quicinc.com/#change,731160\\n\\n  o https://review-android.quicinc.com/#change,731551\\n\\n  o https://review-android.quicinc.com/#change,733219\\n\\n  o https://review-android.quicinc.com/#change,734250\\n\\n  o https://review-android.quicinc.com/#change,734472\\n\\n  o https://review-android.quicinc.com/#change,734487\\n\\n  o https://review-android.quicinc.com/#change,734503\\n\\n  o https://review-android.quicinc.com/#change,734889\\n\\n  o https://review-android.quicinc.com/#change,734923\\n\\n  o https://review-android.quicinc.com/#change,735244\\n\\n  o https://review-android.quicinc.com/#change,735559\\n\\n  o https://review-android.quicinc.com/#change,736352\\n\\n  o https://review-android.quicinc.com/#change,733482\\n\\n  o https://review-android.quicinc.com/#change,734797\\n\\n  o https://review-android.quicinc.com/#change,735646\\n\\n  o https://review-android.quicinc.com/#change,738976\\n\\n  o https://review-android.quicinc.com/#change,739919\\n\\n  o https://review-android.quicinc.com/#change,740134\\n\\n  o https://review-android.quicinc.com/#change,707889\\n\\n  o https://review-android.quicinc.com/#change,717048\\n\\n  o https://review-android.quicinc.com/#change,717049\\n\\n  o https://review-android.quicinc.com/#change,717050\\n\\n  o https://review-android.quicinc.com/#change,725038\\n\\n  o https://review-android.quicinc.com/#change,729385\\n\\n  o https://review-android.quicinc.com/#change,738249\\n\\n  o https://review-android.quicinc.com/#change,734263\\n\\n\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\ngit-android.quicinc.com/mdm/manifest:master:default.xml\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\nhttps://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId\\u003d3219788\\n\\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------\\n\\n  o https://review-android.quicinc.com/#change,716076\\n\\n  o https://review-android.quicinc.com/#change,737755\\n\\n  o https://review-android.quicinc.com/#change,703116\\n\\n  o https://review-android.quicinc.com/#change,707889\\n\\n  o https://review-android.quicinc.com/#change,717048\\n\\n  o https://review-android.quicinc.com/#change,717049\\n\\n  o https://review-android.quicinc.com/#change,717050\\n\\n  o https://review-android.quicinc.com/#change,725038\\n\\n  o https://review-android.quicinc.com/#change,729385\\n\\n  o https://review-android.quicinc.com/#change,738249\\n\\n\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\ngit-android.quicinc.com/platform/manifest:master_64:default.xml\\n\\n\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\u003d\\n\\nhttps://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId\\u003d3219790\\n\\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------\\n\\n  o https://review-android.quicinc.com/#change,716076\\n\\n  o https://review-android.quicinc.com/#change,737755\\n\\n  o https://review-android.quicinc.com/#change,739365\\n\\n  o https://review-android.quicinc.com/#change,703116\\n\\n  o https://review-android.quicinc.com/#change,733482\\n\\n  o https://review-android.quicinc.com/#change,734797\\n\\n  o https://review-android.quicinc.com/#change,735646\\n\\n  o https://review-android.quicinc.com/#change,738976\\n\\n  o https://review-android.quicinc.com/#change,740134\\n\\n  o https://review-android.quicinc.com/#change,707889\\n\\n  o https://review-android.quicinc.com/#change,717048\\n\\n  o https://review-android.quicinc.com/#change,717049\\n\\n  o https://review-android.quicinc.com/#change,717050\\n\\n  o https://review-android.quicinc.com/#change,725038\\n\\n  o https://review-android.quicinc.com/#change,729385\\n\\n  o https://review-android.quicinc.com/#change,738249\\n\\n\\n\\nPlease note that verification of all changes in this batch need to be successful before this change can be merged.\\n\\nPLEASE DO NOT UPLOAD A NEW PATCH SET, OR REMOVE APPROVALS UNTIL THE VERIFICATION IS COMPLETE.\\n"},{"timestamp":1399436746,"reviewer":{"name":"Preflight Locking User","email":"preflight@localhost","username":"preflight"},"message":"Patch Set 1: Not developer verified\\n\\nUnlocked"},{"timestamp":1399436759,"reviewer":{"name":"Linux Build Service Account","email":"lnxbuild@localhost","username":"lnxbuild"},"message":"Patch Set 1:\\n\\n\\nAborted verification due to sibling job failure as part of parallelverification. This change will get picked up in subsequent verification cycles. No action is needed.\\n\\n"},{"timestamp":1399437231,"reviewer":{"name":"Preflight Locking User","email":"preflight@localhost","username":"preflight"},"message":"Patch Set 1: Developer Build and Test Successful\\n\\nLocked for preflight"}]}\n', '{"type":"stats","rowCount":1,"runTimeMilliseconds":4}\n']
dict_data =json.loads(str(''.join([item.replace('\n', '') for item in gerritinfo])))
for c in dict_data['comments']:
    if c['reviewer']['name'].startswith('Klocwork'): # you can use exact search
        print c['message']

Error:

Traceback (most recent call last):
  File "test.py", line 3, in <module>
    dict_data =json.loads(str(''.join([item.replace('\n', '') for item in gerritinfo])))
  File "/usr/lib/python2.7/json/__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 369, in decode
    raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 1 column 26242 - line 1 column 26295 (char 26242 - 26295)

replace method only for string, not a list . 替换方法仅用于字符串,而不是列表。 so we mention the position of particular list value 所以我们提到特定列表值的位置

dict_data =gerritinfo[0].replace('\n','')

if you want total list value in dict_data means that you can use for loop 如果你想要dict_data中的总列表值意味着你可以使用for循环

a=[item.replace('\n', '') for item in gerritinfo]
print a

If you just want to get rid of \\n s in your list, the following code would do it. 如果您只想删除列表中的\\n s,则以下代码将执行此操作。

gerritinfo = [
    '{"project":... ... Locked for preflight"}]}\n',
    '{"type":"stats","rowCount":1,"runTimeMilliseconds":4}\n'
]
print ''.join([item.rstrip('\n') for item in gerritinfo])

UPDATE UPDATE

The following code may work. 以下代码可能有效。 If I didn't misunderstand your question. 如果我没有误解你的问题。

import json
# gerritinfo = [....]
dict_data =json.loads(gerritinfo[0])
for c in dict_data['comments']:
    if c['reviewer']['name'].startswith('Klocwork'): # you can use exact search
        print c['message']

output: 输出:

Patch Set 1: 补丁集1:

This change is being verified in klocwork for the following manifests along with other changes as detailed below: 此更改正在klocwork中验证以下清单以及其他更改,详情如下:

===================================================================================== ================================================== ===================================

git-android.quicinc.com/platform/manifest:kk:default.xml git-android.quicinc.com/platform/manifest:kk:default.xml

===================================================================================== ================================================== ===================================

https://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId=3217513 https://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId=3217513


o https://review-android.quicinc.com/#change , o https://review-android.quicinc.com/#change ,

Please note that verification of all changes in this batch need to be successful before this change can be merged. 请注意,在合并此更改之前,需要验证此批次中的所有更改是否成功。

PLEASE DO NOT UPLOAD A NEW PATCH SET, OR REMOVE APPROVALS UNTIL THE VERIFICATION IS COMPLETE. 在验证完成之前,请不要上传新的补丁集或删除批准。

Patch Set 1: Verified 补丁集1:已验证

Successful klocwork verification. 成功的klocwork验证。 You may find the results of the verification by following the link(s) below: 您可以通过以下链接找到验证结果:

https://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId=3217513 https://commander.qualcomm.com/commander/pages/SimplifiedJobView/LoadComponent_run?jobId=3217513

Because gerritinfo is a list, you have to access .replace() with each string in the list. 因为gerritinfo是一个列表,所以您必须使用列表中的每个字符串访问.replace() Here is a method using list comprehension: 这是一个使用列表理解的方法:

import json
gerritinfo=['{"project":... ... Locked for preflight"}]}\n', '{"type":"stats","rowCount":1,"runTimeMilliseconds":4}\n']

dict_data =json.loads(str(''.join([item.replace('\n', '') for item in gerritinfo])))
for c in dict_data['comments']:
    if c['reviewer']['name'].startswith('Klocwork'): # you can use exact search
        print c['message']

Using list comprehension, we loop over each item in gerritinfo and we call the .replace() on it. 使用列表gerritinfo ,我们gerritinfo每个项目,并在其上调用.replace()

Here is a little example of using list comprehension: 这是使用列表理解的一个小例子:

>>> squares = range(1, 11)
>>> squares
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> squares = [x**2 for x in squares]
>>> squares
[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
>>> 
mylst = map(lambda each:each.strip("\n"), gerritinfo)  
print mylst  

This works for lists. 这适用于列表。 You're essentially deleting the character from the elements of the list. 你基本上是从列表的元素中删除字符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AttributeError: 'list' object 没有属性 'replace' Python - AttributeError: 'list' object has no attribute 'replace' Python AttributeError: &#39;list&#39; 对象没有属性 &#39;replace&#39; &quot;fasttext&quot; - AttributeError: 'list' object has no attribute 'replace' "fasttext" AttributeError:“列表”对象没有属性“替换”, - AttributeError: 'list' object has no attribute 'replace', “AttributeError:'list' object 没有属性'replace' - "AttributeError: 'list' object has no attribute 'replace' python AttributeError:“ NoneType”对象在列表中没有属性“ replace” - python AttributeError: 'NoneType' object has no attribute 'replace' in list AttributeError:'list'对象在尝试删除字符时没有属性'replace' - AttributeError: 'list' object has no attribute 'replace' when trying to remove character AttributeError:“ list”对象在尝试删除“ / n”时没有属性“ replace” - AttributeError: 'list' object has no attribute 'replace' while trying to remove '/n' AttributeError: 'list' object 没有属性 'replace' Selenium Python - AttributeError: 'list' object has no attribute 'replace' Selenium Python AttributeError:在更改数组期间“列表”对象没有属性“替换” - AttributeError: 'list' object has no attribute 'replace' during change array AttributeError: 'list' object 没有属性 - AttributeError: 'list' object has no attribute
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM