How do I stop Python treating list items as one item instead of multiple when appending to another list?

Question:

I have a list called MBN2 thats values are 15 and 13. I’m trying to append it to another list called BoutNumber2, but when I try to do this it treats MBN2 as one list item [’15’, ’13’] instead of two. When I print the length of MBN2 it says two so I’m not sure why it’s doing this. Here is the block of code

            for test4 in soup.select('.fight_card_resume'):
                MBN2.append(test4.find('td').get_text().replace('Match ', ''))
            for test7 in soup.select('.new_table_holder [itemprop="subEvent"] td'):
                BoutNumber.append(test7.get_text().strip())
                BoutNumber2 = BoutNumber[0::7]
                BoutNumber2.append(MBN2)

and this is what I get when I print BoutNumber2 afterwards

['14', '13', '12', '11', '10', '9', '8', '7', '6', '5', '4', '3', '2', '1', '12', '11', '10', '9', '8', '7', '6', '5', '4', '3', '2', '1', ['15', '13']]

How do I get Python to treat the appended 15 and 13 as seperate?

Asked By: yfr code

||

Answers:

Just this should work:

BoutNumber2 = BoutNumber2 + MBN2

or you could do

BoutNumber2.extend(MBN2)

Both solutions should do the job.

Answered By: SnoopFrog
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.