def anything(arg): if type(arg) == list: print 'yes it\'s a list element : {}'.format(arg) elif type(arg) == set: print 'this is a set: {}'.format(arg) # elif type(arg) == dict(arg): # print 'this is a dictionary element {}: {}'.format() elif type(arg) == tuple: print 'this is a tuple: {}'.format(arg) elif type(arg) == str: print 'this is a string: {}'.format(arg) else: print ('Invalid format') # anything(arg = {'arg' : 'ashish'}) #NOT WORKING anything(arg = ['ashish']) anything(arg = {'set'}) anything(arg = ('tuple')) #HERE TUPLE ALSO PROVIDE TYPE STRING HOW?? anything(arg = 'string')
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)