Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How can we pass optional or keyword parameters from one function to another in Python?

Answer Posted / chaitanya

Gather the arguments using the * and ** specifiers in the function's parameter list. This gives us positional arguments as a tuple and the keyword arguments as a dictionary. Then we can pass these arguments while calling another function by using * and **:

def fun1(a, *tup, **keywordArg):

...

keywordArg['width']='23.3c'

...

Fun2(a, *tup, **keywordArg)

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the best tutorial for python?

1008


Explain me what does the keyword do?

872


What is the difference between ‘match’ and ‘search’ in python?

808


Is empty python dataframe?

882


Whats the difference between input() and raw_input()?

965


Is geany good for python?

850


How to convert a list into a tuple?

913


What is __ init__ in python?

917


What static means?

944


How do I use strftime in python?

933


What do you understand by python generator?

984


How to set the figure title and axes labels font size in matplotlib?

832


What is the language from which Python has got its features or derived its features?

972


How to find the index of an element in a list python?

852


What are static methods for?

948