Answer the question
In order to leave comments, you need to log in
Python only writes first value to csv file?
I wrote a parser, but why do I have img and the sizes write in csv go to rows, not columns, how to make it write to rows?
My data is parsed like
this
now
bb_strings = re.findall(r'var model = ({.*})', ad)
bp = {}
if bb_strings:
bp = json.loads(bb_strings[0])
for bl in bp['AVAILABLE_SIZES']:
footlocker.append(('размер', bl))
for k in d['set']['item']:
dd = '{url}{ext}{end}'.format(url=imgurg, ext=k['i']['n'], end='?id=Y6YPH3?&wid=1280&hei=877&fmt.png')
t = requests.get(dd)
out = open('images/%s' % dd.split('/')[-1], 'wb')
out.write(t.content)
footlocker.append(('images', dd.split('/')[-1]))
out.close()
Answer the question
In order to leave comments, you need to log in
razmer = 0
bb_strings = re.findall(r'var model = ({.*})', ad)
bp = {}
if bb_strings:
bp = json.loads(bb_strings[0])
for bl in bp['AVAILABLE_SIZES']:
razmer +=1
footlocker.append(('razmer%s' %razmer, bl))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question