0
I need to create an array that has Indice and values
page_links
receives the links of a page
all_links_main = []
for link in page_links:
all_links_main.append(link.get('href'))
produto = []
for link1 in all_links_main:
page_one = requests.get(link1)
print(page_one)
soup_one = BeautifulSoup(page_one.content, 'html.parser')
I need to include something like:
Indice
0
[name, value, image]
1
[name, value, image]
...
But I’m not getting it.
To my mind would be an array within the other (two-dimensional), I am new in python.
Do you need within an array position to have the values of name, value and image? Sorry, I didn’t get it right.
– Daniel Mendes
I need to do it anyway.
– JB_
It would not be better then to create a class that has these attributes and then add the class to the array?
– Daniel Mendes
I need to take the products of a site, example site a And save the name, value and image of that product in the array to later save in the bank. I don’t know how I could do it like that.
– JB_
Check this example with class, https://pastebin.com/eJLvBQ4J
– Daniel Mendes
Let’s go continue this discussion in chat.
– JB_
@Danielmendes had said he would not use with class, but I used had some problems implementing with class to save in the bank the arrays with the
executemany
made an error:TypeError: 'Produto' object is not iterable
you know how I can fix?– JB_