How to use 'take list as input in python' in Python

Every line of 'take list as input in python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
170def makeList(input):
171 if isinstance(input, basestring):
172 return [ input ]
173 elif input is None:
174 return [ ]
175 else:
176 return list(input)
44def raise_to_list(_input):
45 """
46 This will take an input and raise it to a List (if applicable)
48 :param _input: object to raise to a list
49 :type _input: Object
51 :return: the object as a list, or none
52 :rtype: List or None
53 """
54 if _input is None:
55 return None
56 elif isinstance(_input, list):
57 return _input
58 else:
59 return [_input]

Related snippets