2

In JavaScript I can use arguments in a function like:

function a (){
   console.log(arguments);
}

a(1,2,3,4,5,6) // Arguments(6) [1, 2, 3, 4, 5, 6, callee: ƒ, 
                Symbol(Symbol.iterator): ƒ]

Do functions in Python have an object like JavaScript's arguments?

I tried to use arguments in python (like in JavaScript) but I am getting an error, maybe there is an object in python but it is not called 'arguments'?

How can I get all the arguments of a function in python ?

0

1 Answer 1

4

In Python to have access to arguments like in JS you would do following:

def funcA(*args):
   print(args)

You can use any name you want in place of args

funcA(1,2,3) # prints (1, 2, 3)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.