2017-09-01 5 views
0

私はこの番号をどのように引き出すことができるのかと全く混同しています312012?それを引き出すことができるように指定するタイトルはないようです。応答テキストから手作業でプルする必要なしに、この番号を取得するにはどうすればよいですか? 私は以下のすべてのjavascriptを引っ張りました。また、var combinationsの内容を引き出す方法もわかりません。どちらの質問にも助けがありますか?タイトルを持たない変数をプルする方法は?

import requests 
product_url = "https://www.slamjamsocialism.com/sneakers/42636-ultraboost-uncaged-primeknit-sneakers.html" 
response0 = s.get(product_url) 
soup1 = BeautifulSoup(response0.text, 'lxml') 
html1 = soup1.find_all('script')[1]  #.text 
print(html1) 

全Response.text:プルしようとしているキーイムが含まれてい

<!DOCTYPE HTML> <!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7 " lang="en"><![endif]--> <!--[if IE 7]><html class="no-js lt-ie9 lt-ie8 ie7" lang="en"><![endif]--> <!--[if IE 8]><html class="no-js lt-ie9 ie8" lang="en"><![endif]--> <!--[if gt IE 8]><html class="no-js ie9" lang="en"><![endif]--><html lang="en"><head><meta name="referrer" content="always"><meta charset="utf-8" /><script type="text/javascript">window.NREUM||(NREUM={}),__nr_require=function(e,n,t){function r(t){if(!n[t]){var o=n[t]={exports:{}};e[t][0].call(o.exports,function(n){var o=e[t][1][n];return r(o||n)},o,o.exports)}return n[t].exports}if("function"==typeof __nr_require)return __nr_require;for(var o=0;o<t.length;o++)r(t[o]);return r}({1:[function(e,n,t){function r(){}function o(e,n,t){return function(){return i(e,[c.now()].concat(u(arguments)),n?null:this,t),n?void 0:this}}var i=e("handle"),a=e(2),u=e(3),f=e("ee").get("tracer"),c=e("loader"),s=NREUM;"undefined"==typeof window.newrelic&&(newrelic=s);var p=["setPageViewName","setCustomAttribute","setErrorHandler","finished","addToTrace","inlineHit","addRelease"],d="api-",l=d+"ixn-";a(p,function(e,n){s[n]=o(d+n,!0,"api")}),s.addPageAction=o(d+"addPageAction",!0),s.setCurrentRouteName=o(d+"routeName",!0),n.exports=newrelic,s.interaction=function(){return(new r).get()};var m=r.prototype={createTracer:function(e,n){var t={},r=this,o="function"==typeof n;return i(l+"tracer",[c.now(),e,t],r),function(){if(f.emit((o?"":"no-")+"fn-start",[c.now(),r,o],t),o)try{return n.apply(this,arguments)}finally{f.emit("fn-end",[c.now()],t)}}}};a("setName,setAttribute,save,ignore,onEnd,getContext,end,get".split(","),function(e,n){m[n]=o(l+n)}),newrelic.noticeError=function(e){"string"==typeof e&&(e=new Error(e)),i("err",[e,c.now()])}},{}],2:[function(e,n,t){function r(e,n){var t=[],r="",i=0;for(r in e)o.call(e,r)&&(t[i]=n(r,e[r]),i+=1);return t}var o=Object.prototype.hasOwnProperty;n.exports=r},{}],3:[function(e,n,t){function r(e,n,t){n||(n=0),"undefined"==typeof t&&(t=e?e.length:0);for(var r=-1,o=t-n||0,i=Array(o<0?0:o);++r<o;)i[r]=e[n+r];return i}n.exports=r},{}],4:[function(e,n,t){n.exports={exists:"undefined"!=typeof window.performance&&window.performance.timing&&"undefined"!=typeof window.performance.timing.navigationStart}},{}],ee:[function(e,n,t){function r(){}function o(e){function n(e){return e&&e instanceof r?e:e?f(e,u,i):i()}function t(t,r,o,i){if(!d.aborted||i){e&&e(t,r,o);for(var a=n(o),u=m(t),f=u.length,c=0;c<f;c++)u[c].apply(a,r);var p=s[y[t]];return p&&p.push([b,t,r,a]),a}}function l(e,n){v[e]=m(e).concat(n)}function m(e){return v[e]||[]}function w(e){return p[e]=p[e]||o(t)}function g(e,n){c(e,function(e,t){n=n||"feature",y[t]=n,n in s||(s[n]=[])})}var v={},y={},b={on:l,emit:t,get:w,listeners:m,context:n,buffer:g,abort:a,aborted:!1};return b}function i(){return new r}function a(){(s.api||s.feature)&&(d.aborted=!0,s=d.backlog={})}var u="[email protected]",f=e("gos"),c=e(2),s={},p={},d=n.exports=o();d.backlog=s},{}],gos:[function(e,n,t){function r(e,n,t){if(o.call(e,n))return e[n];var r=t();if(Object.defineProperty&&Object.keys)try{return Object.defineProperty(e,n,{value:r,writable:!0,enumerable:!1}),r}catch(i){}return e[n]=r,r}var o=Object.prototype.hasOwnProperty;n.exports=r},{}],handle:[function(e,n,t){function r(e,n,t,r){o.buffer([e],r),o.emit(e,n,t)}var o=e("ee").get("handle");n.exports=r,r.ee=o},{}],id:[function(e,n,t){function r(e){var n=typeof e;return!e||"object"!==n&&"function"!==n?-1:e===window?0:a(e,i,function(){return o++})}var o=1,i="[email protected]",a=e("gos");n.exports=r},{}],loader:[function(e,n,t){function r(){if(!x++){var e=h.info=NREUM.info,n=d.getElementsByTagName("script")[0];if(setTimeout(s.abort,3e4),!(e&&e.licenseKey&&e.applicationID&&n))return s.abort();c(y,function(n,t){e[n]||(e[n]=t)}),f("mark",["onload",a()+h.offset],null,"api");var t=d.createElement("script");t.src="https://"+e.agent,n.parentNode.insertBefore(t,n)}}function o(){"complete"===d.readyState&&i()}function i(){f("mark",["domContent",a()+h.offset],null,"api")}function a(){return E.exists&&performance.now?Math.round(performance.now()):(u=Math.max((new Date).getTime(),u))-h.offset}var u=(new Date).getTime(),f=e("handle"),c=e(2),s=e("ee"),p=window,d=p.document,l="addEventListener",m="attachEvent",w=p.XMLHttpRequest,g=w&&w.prototype;NREUM.o={ST:setTimeout,SI:p.setImmediate,CT:clearTimeout,XHR:w,REQ:p.Request,EV:p.Event,PR:p.Promise,MO:p.MutationObserver};var v=""+location,y={beacon:"bam.nr-data.net",errorBeacon:"bam.nr-data.net",agent:"js-agent.newrelic.com/nr-1044.min.js"},b=w&&g&&g[l]&&!/CriOS/.test(navigator.userAgent),h=n.exports={offset:u,now:a,origin:v,features:{},xhrWrappable:b};e(1),d[l]?(d[l]("DOMContentLoaded",i,!1),p[l]("load",r,!1)):(d[m]("onreadystatechange",o),p[m]("onload",r)),f("mark",["firstbyte",u],null,"api");var x=0,E=e(4)},{}]},{},["loader"]);</script><title>adidas originals Ultraboost Uncaged Sneakers Sneakers - Slam Jam Socialism</title><meta name="description" content="adidas originals UltraBoost Uncaged Primeknit Sneakers White/Crystal White from the Fall Winter 2017 Collection" /><meta name="viewport" content="width=device-width, minimum-scale=0.25, maximum-scale=1.0, initial-scale=1.0, user-scalable=no" /><meta name="apple-mobile-web-app-capable" content="yes" /><link rel="icon" type="image/vnd.microsoft.icon" href="/img/favicon.ico" /><link rel="shortcut icon" type="image/x-icon" href="/img/favicon.ico" /><link rel="stylesheet" href="/themes/slam-jam/css/global.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/autoload/chosen.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/autoload/font-awesome.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/autoload/highdpi.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/autoload/owl.carousel.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/autoload/responsive-tables.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/autoload/slamjam-style.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/autoload/superfish-modified.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/autoload/uniform.default.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/autoload/z-responsive.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/product.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/print.css" type="text/css" media="print" /><link rel="stylesheet" href="/js/jquery/plugins/fancybox/jquery.fancybox.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/modules/socialsharing/css/socialsharing.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/modules/blockcart/blockcart.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/modules/blocklanguages/blocklanguages.css" type="text/css" media="all" /><link rel="stylesheet" href="/modules/themeconfigurator/css/hooks.css" type="text/css" media="all" /><link rel="stylesheet" href="/js/jquery/plugins/autocomplete/jquery.autocomplete.css" type="text/css" media="all" /><link rel="stylesheet" href="/themes/slam-jam/css/modules/belvg_sizeassistant/css/styles.css" type="text/css" media="all" /><link rel="stylesheet" href="/modules/mailalerts/css/mailalerts.css" type="text/css" media="all" /><link rel="stylesheet" href="/modules/paypal/views/css/paypal.css" type="text/css" media="all" /><link rel="stylesheet" href="/modules/pagecache/views/css/pagecache.css" type="text/css" media="all" /><link rel="stylesheet" href="/modules/newsletterpopupli/js/fancybox/jquery.fancybox.css" type="text/css" media="all" /><link rel="stylesheet" href="/modules/newsletterpopupli/css/newsletterpopupli.css" type="text/css" media="all" /><link rel="stylesheet" href="/modules/slidecaptcha/views/css/QapTcha.jquery16.css" type="text/css" media="all" /><link rel="stylesheet" href="/modules/pronesismassaddaccessories/views/css/pronesismassaddaccessories.css" type="text/css" media="all" /> <script type="text/javascript">var CUSTOMIZE_TEXTFIELD = 1; 
var FancyboxI18nClose = 'Close'; 
var FancyboxI18nNext = 'Next'; 
var FancyboxI18nPrev = 'Previous'; 
var PS_CATALOG_MODE = false; 
var ajax_allowed = true; 
var ajaxsearch = true; 
var allowBuyWhenOutOfStock = false; 
var attribute_anchor_separator = '-'; 
var attributesCombinations = [{"id_attribute":"891","id_attribute_group":"90","attribute":"7","group":"adidas_men_s_women_s_footwear_size_chart"},{"id_attribute":"3006","id_attribute_group":"305","attribute":"36","group":"cz02web"},{"id_attribute":"3008","id_attribute_group":"305","attribute":"36_2_3","group":"cz02web"},{"id_attribute":"3011","id_attribute_group":"305","attribute":"37_1_3","group":"cz02web"},{"id_attribute":"3012","id_attribute_group":"305","attribute":"38","group":"cz02web"},{"id_attribute":"3014","id_attribute_group":"305","attribute":"38_2_3","group":"cz02web"},{"id_attribute":"3017","id_attribute_group":"305","attribute":"39_1_3","group":"cz02web"},{"id_attribute":"3018","id_attribute_group":"305","attribute":"40","group":"cz02web"},{"id_attribute":"3020","id_attribute_group":"305","attribute":"40_2_3","group":"cz02web"},{"id_attribute":"3023","id_attribute_group":"305","attribute":"41_1_3","group":"cz02web"},{"id_attribute":"3024","id_attribute_group":"305","attribute":"42","group":"cz02web"},{"id_attribute":"3026","id_attribute_group":"305","attribute":"42_2_3","group":"cz02web"},{"id_attribute":"3029","id_attribute_group":"305","attribute":"43_1_3","group":"cz02web"},{"id_attribute":"3030","id_attribute_group":"305","attribute":"44","group":"cz02web"},{"id_attribute":"3032","id_attribute_group":"305","attribute":"44_2_3","group":"cz02web"},{"id_attribute":"3035","id_attribute_group":"305","attribute":"45_1_3","group":"cz02web"},{"id_attribute":"3036","id_attribute_group":"305","attribute":"46","group":"cz02web"},{"id_attribute":"3038","id_attribute_group":"305","attribute":"46_2_3","group":"cz02web"},{"id_attribute":"3041","id_attribute_group":"305","attribute":"47_1_3","group":"cz02web"},{"id_attribute":"3042","id_attribute_group":"305","attribute":"48","group":"cz02web"},{"id_attribute":"3044","id_attribute_group":"305","attribute":"48_2_3","group":"cz02web"}]; 
var availableLaterValue = ''; 
var availableNowValue = ''; 
var baseDir = 'https://www.slamjamsocialism.com/'; 
var baseUri = 'https://www.slamjamsocialism.com/'; 
var combinations = {"305705":{"attributes_values":{"90":"7"},"attributes":[891],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'891'"},"312011":{"attributes_values":{"305":"36"},"attributes":[3006],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950018","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3006'"},"312012":{"attributes_values":{"305":"36 2\/3"},"attributes":[3008],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950025","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3008'"},"312013":{"attributes_values":{"305":"37 1\/3"},"attributes":[3011],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950032","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3011'"},"312014":{"attributes_values":{"305":"38"},"attributes":[3012],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950049","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3012'"},"312015":{"attributes_values":{"305":"38 2\/3"},"attributes":[3014],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950056","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3014'"},"312016":{"attributes_values":{"305":"39 1\/3"},"attributes":[3017],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950063","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3017'"},"312017":{"attributes_values":{"305":"40"},"attributes":[3018],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950070","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3018'"},"312018":{"attributes_values":{"305":"40 2\/3"},"attributes":[3020],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950087","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3020'"},"312019":{"attributes_values":{"305":"41 1\/3"},"attributes":[3023],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":2,"reference":"2000081950094","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3023'"},"312020":{"attributes_values":{"305":"42"},"attributes":[3024],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":2,"reference":"2000081950100","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3024'"},"312021":{"attributes_values":{"305":"42 2\/3"},"attributes":[3026],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":3,"reference":"2000081950117","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3026'"},"312022":{"attributes_values":{"305":"43 1\/3"},"attributes":[3029],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":4,"reference":"2000081950124","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3029'"},"312023":{"attributes_values":{"305":"44"},"attributes":[3030],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":3,"reference":"2000081950131","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3030'"},"312024":{"attributes_values":{"305":"44 2\/3"},"attributes":[3032],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":4,"reference":"2000081950148","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3032'"},"312025":{"attributes_values":{"305":"45 1\/3"},"attributes":[3035],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":2,"reference":"2000081950155","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3035'"},"312026":{"attributes_values":{"305":"46"},"attributes":[3036],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":2,"reference":"2000081950162","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3036'"},"312027":{"attributes_values":{"305":"46 2\/3"},"attributes":[3038],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950179","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3038'"},"312028":{"attributes_values":{"305":"47 1\/3"},"attributes":[3041],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950186","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3041'"},"312029":{"attributes_values":{"305":"48"},"attributes":[3042],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950193","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3042'"},"312030":{"attributes_values":{"305":"48 2\/3"},"attributes":[3044],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950209","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3044'"}} 

パート:

var combinations = {"305705":{"attributes_values":{"90":"7"},"attributes":[891],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'891'"},"312011":{"attributes_values":{"305":"36"},"attributes":[3006],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950018","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3006'"},"312012":{"attributes_values":{"305":"36 2\/3"},"attributes":[3008],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950025","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3008'"},"312013":{"attributes_values":{"305":"37 1\/3"},"attributes":[3011],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950032","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3011'"},"312014":{"attributes_values":{"305":"38"},"attributes":[3012],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950049","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3012'"},"312015":{"attributes_values":{"305":"38 2\/3"},"attributes":[3014],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950056","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3014'"},"312016":{"attributes_values":{"305":"39 1\/3"},"attributes":[3017],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950063","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3017'"},"312017":{"attributes_values":{"305":"40"},"attributes":[3018],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950070","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3018'"},"312018":{"attributes_values":{"305":"40 2\/3"},"attributes":[3020],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950087","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3020'"},"312019":{"attributes_values":{"305":"41 1\/3"},"attributes":[3023],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":2,"reference":"2000081950094","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3023'"},"312020":{"attributes_values":{"305":"42"},"attributes":[3024],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":2,"reference":"2000081950100","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3024'"},"312021":{"attributes_values":{"305":"42 2\/3"},"attributes":[3026],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":3,"reference":"2000081950117","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3026'"},"312022":{"attributes_values":{"305":"43 1\/3"},"attributes":[3029],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":4,"reference":"2000081950124","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3029'"},"312023":{"attributes_values":{"305":"44"},"attributes":[3030],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":3,"reference":"2000081950131","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3030'"},"312024":{"attributes_values":{"305":"44 2\/3"},"attributes":[3032],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":4,"reference":"2000081950148","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3032'"},"312025":{"attributes_values":{"305":"45 1\/3"},"attributes":[3035],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":2,"reference":"2000081950155","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3035'"},"312026":{"attributes_values":{"305":"46"},"attributes":[3036],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":2,"reference":"2000081950162","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3036'"},"312027":{"attributes_values":{"305":"46 2\/3"},"attributes":[3038],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950179","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3038'"},"312028":{"attributes_values":{"305":"47 1\/3"},"attributes":[3041],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950186","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3041'"},"312029":{"attributes_values":{"305":"48"},"attributes":[3042],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950193","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3042'"},"312030":{"attributes_values":{"305":"48 2\/3"},"attributes":[3044],"price":0,"specific_price":false,"ecotax":0,"weight":0,"quantity":0,"reference":"2000081950209","unit_impact":"0.00","minimal_quantity":"1","available_date":"","id_image":-1,"list":"'3044'"}} 
+0

これは、Pythonではありません。しかし、それがあれば、それは 'dict'リテラルであり、それは変数ではなく、' dict'の鍵です。 –

+0

実際、それは価値ではありません。それは鍵です。あなたはdictの仕様を見てください –

+0

JSONオブジェクトで初期化されたJavaScript変数があります。この行をPythonで処理したい場合は、 'var combinations ='部分(正規表現またはより単純な文字列操作関数)を削除し、残りの文字列を 'json.loads()'に渡す必要があります。 – DyZ

答えて

0

まず、(それはで始まると仮定すると、応答のJSONの一部を抽出最初の開きブレースで終わり、最後の閉じたブレースで終わります)。

text = response0.text[response0.text.find('{') : response0.text.rfind('}') + 1] 

次に、Pythonの辞書にJSON文字列に変換する:あなたはこの辞書のキーを探している

data = json.loads(text) 

print(data.keys()) 
# dict_keys(['312026', '312011', '312012', '312027', '312015', '312024', '312017', 
#   '312022', '312020', '312019', '312021', '312018', '312029', '312016', 
#   '312030', '312013', '305705', '312023', '312025', '312028', '312014']) 
+0

ありがとう、私のためにこれを壊すために、非常にステップを越えることに費やした時間を感謝します。 – donkeyheadjoe

関連する問題