0 votes
1 view
in Data Science by (18.3k points)

I have the function which I am not able to edit, this function expects 3 arguments

def rgb_color(r,g,b):


now I have the values as the array, I can change this var if needed to the list or something

black = [0, 0, 0]

Is there any way to pass each variable black to the function without using

black[0], black[1], black[2]

something like this:

call_user_function(rgb_color, black) 

1 Answer

0 votes
by (36.8k points)

These are the possible solutions, it all depends on each exact behavior you're looking for.

This produces a correct output:

from bs4 import BeautifulSoup

html_src = \




    <div class="small subtle link">

        <a href="https://example.com" nofollow="" target='"_blank"'>



        This text!





soup = BeautifulSoup(html_src, 'lxml')


div_tag = soup.find(name='div', attrs={'class': 'small subtle link'})

div_content_text = []

for curr_text in div_tag.find_all(recursive=False, text=True):

    curr_text = curr_text.strip()

    if curr_text:



Want to be a master in Data Science? Enroll in this Data Science Courses 

Welcome to Intellipaat Community. Get your technical queries answered by top developers !