Monday, 9 September 2013

Variable number of arguments in python

Variable number of arguments in python

def func(*arg):
for i in arg:
print(i)
Here if a user is allowed to enter the arguments using input function
(python 3.x).
Eg : "Hello,World,Good,Morning"
If we want each word which is seperated by comma must be passed as
argument...
Eg: func("Hello",World","Good","Morning")
how can i solve this problem..

No comments:

Post a Comment