At End---->using append
At Starts--->my_list.insert(0, value_to_add)
At Specific Index----->my_list.insert(index_to_insert, value_to_add)
At End
my_list = [1, 2, 3, 4]
value_to_add = 5
my_list.append(value_to_add)
print(my_list)  # Output: [1, 2, 3, 4, 5]
=====or==========
all_match.append(rank_match.text)
At Starts
my_list = [2, 3, 4]
value_to_add = 1
my_list.insert(0, value_to_add)
print(my_list)  # Output: [1, 2, 3, 4]
========or=======
all_match.insert(0, rank_match.text)
all_match
At Specific Index
my_list = [1, 2, 3, 4]
value_to_add = 5
index_to_insert = 2  # Insert at index 2 (0-based index)
my_list.insert(index_to_insert, value_to_add)
print(my_list)  # Output: [1, 2, 5, 3, 4]
In Webscrapping
Coding
match_point = soup.find_all('td', class_="table-body__cell u-center-text")
match_point
all_match_point=[]
for tag in match_point:    
    all_match_point.append(tag.text.strip())
all_match_point
match_data = match_point[::2]
match_data
rank_match = soup.find('td', class_="rankings-block__banner--matches")
rank_match.text
output
'27'
all_match=[]
for tag in match_data:    
    all_match.append(tag.text.strip())
all_match
output
Append at end of list
all_match.append(rank_match.text)
output
['27',
 '40',
 '28',
 '23',
 '31',
 '33',
 '37',
 '21',
 '38',
 '30',
 '33',
 '24',
 '28',
 '42',
 '28',
 '31',
 '24',
 '41',
 '27']
Append at start of list
all_match.insert(0, rank_match.text)
all_match
output
Top comments (0)