Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

How to change all the function arguments to lowercase in Python?

I have the following code

def foo(ARG1, ARG2): pass

How do I convert the function arguments ARG1 and ARG2 to lowercase in python?


1 Answer
Rajendra Dharmkar

The following code will convert the given function arguments to lowercase.

#program to print lowercase of the list of function arguments
import inspect
def foo(ARG1, ARG2): pass
list1 = inspect.getargspec(foo)[0]
list1 =[item.lower() for item in list1]
 print list1

OUTPUT

['arg1', 'arg2']
Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.