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

Should I learn python or scala?

841


What is the difference between a tuple and a list?

933


Does the same python code work on multiple platforms without any changes?

1015


What is a pep python?

810


What's the difference between python and anaconda programming?

905


What will be the output of data[-2] from the list data = [1,5,8,6,9,3,4]?

748


Give one example for multiple statements in single statement?

811


Is elif a keyword in python?

815


What is python’s standard way of identifying a block of code?

808


What is string replication operator in python?

928


which is the most commonly used package for data importing and manipulation?

864


What is an egg in python?

796


Explain me what is python and explain some of its benefits?

815


Is integer immutable in python?

727


What is the output of the following?

825