I have a variable which can be a single string or a list of string. When the variable is a single string , the loop iterates it by char.
text = function() # the function method can return a single string or list of string
for word in text:
# When it is a single string , it prints char by char.
This should do it:
text = function() if isinstance(text, list): for word in text: print word + "/n" else: print text + "/n"