First of all, I do realize that this is a really simple question and please bear with me on this.
How, in python, can I get the numbers of strings? I am trying to do something like this:
def func(input_strings):
# Make the input_strings iterable
if len(input_strings) == 1:
input_strings = (input_strings, )
# Do something
for input_string in input_strings:
analyze_string(input_string)
return
So with this function, if the input is a list, ['string1', 'string2', 'string3'], it will loop over them; if the input is only one string like 'string1', then it will still take care of it, instead of throwing an exception.
However, the len(str) returns the number of characters in the string and wouldn't give me a "1".
I'd really appreciate your help!