What is the Pythonic Way of Differentiating Between a String and a List?

Viewed 8569

For my program I have a lot of places where an object can be either a string or a list containing strings and other similar lists. These are generally read from a JSON file. They both need to be treated differently. Right now, I am just using isinstance, but that does not feel like the most pythonic way of doing it, so does anyone have a better way of doing it?

6 Answers
Related