파이썬 lstrip, rstrip 사용

# 방법 1 : 
가져 오기 JSON
S = '({ "화물": [{ "beforeSpecifiedTime"거짓 "cityCode": "", "CityName이": "", "commitDay": 60, "회사": "CAINIAO_STANDARD", "companyDisplayName" " AliExpress 표준 배송 ","coreZone ":" ","통화 ":"USD ","cutTime ":"17시 ","deliveryDate ":"2019년 9월 20일 ","deliveryDateDisplay ":"기타 " "할인": 93, "discountType": "약", "domesticFreight": "", "errorCode를"1 "errorDisplayMsg": "", "isCheapestFaster"거짓 "isDefault"사실, "isPromote" 거짓 "isTracked"사실, "localCurrency": "USD", "localPrice": "0.35 ","localPriceFormatStr ":"US $ 0.35 ","localSaveMoney ":"5.02 ","localSaveMoneyFormatStr ":"미국은 $ 5.02 ","localTotalFreight ":"5.37 ","localTotalFreightFormatStr ":"US $ 5.37 ","logisticsDeliveryTimeType " "BUYER_PAY_ORDER", "알림": "", "가격": "0.35", "priceFormatStr": "미국 $ 0.35", "processingTime": 5, "promoteInformation"널 (null) "remainTime": "- 9475079", " saveMoney ":"5.02 ","saveMoneyFormatStr ":"US $ 5.02 ","sendGoodsCountry ":"CN ","sendGoodsCountryFullName ":"중국 ","상태 ":" ","templateDiscount ":" ","templateType """, "시간": "22", "totalFreight": "5.37", "totalFreightFormatStr": "US $ 5.37"}, { "beforeSpecifiedTime"거짓 "cityCode": "", "CityName이": "", "commitDay": 60, "회사": "EMS_ZX_ZX_US", "companyDisplayName": "ePacket", "coreZone": "", "통화": "USD", "cutTime": "17시", "deliveryDate" "2019년 9월 19일", "deliveryDateDisplay": "기타", "할인": 74, "discountType": "약", "domesticFreight": "", "errorCode를"1 "errorDisplayMsg": "" "isCheapestFaster"거짓 "isDefault", "isPromote"거짓 : 거짓 "isTracked "사실,"localCurrency ":"USD ","localPrice ":"1.04 ","localPriceFormatStr ":"US $ 1.04 ","localSaveMoney ":"2.98 ","localSaveMoneyFormatStr ":"US $ 2.98 ","localTotalFreight " "4.02", "localTotalFreightFormatStr": "US $ 4.02", "logisticsDeliveryTimeType": "BUYER_PAY_ORDER", "알림": "", "가격": "1.04", "priceFormatStr": "US $ 1.04", "processingTime" 5, "promoteInformation"널 (null) "remainTime": "- 9475079", "saveMoney": "2.98", "saveMoneyFormatStr": "US $ 2.98", "sendGoodsCountry": "CN", "sendGoodsCountryFullName": "중국" "상태 ":" ","templateDiscount ":" ","templateType ":" ","시간 ":"21 ","totalFreight ":"4.02 ","totalFreightFormatStr ":"US $ 4.02 "}]}) '
이 중 문자 입력인지 S # 1 주
S1 = s.lstrip는 ( '(') #를 삭제 브래킷 왼쪽
S = s1.rstrip ( ')를') #가 오른쪽 괄호 제거
s_dic =를 json.loads 발 # 문자열로 변환 사전
인쇄 (s_dic)

 # 방법 2 :

  평가 () 처리를 사용합니다.

  

추천

출처www.cnblogs.com/fh-fendou/p/11431643.html