Text from file to array with conditions in Python <pre><code> file = open("smth.txt","r") pom = list() string = "" for lines in file: for letter in line: if letter in "0123456789": pom.append(int(letter)) if letter == "T" : pom.append(True) elif letter.isalpha() == True: string += letter pom.append(string) file.close() print(pom) </code></pre> <p>Idea of code should be simple from a line from .txt is: 2,abc,True. The result should be [2, 'abc', True] so numbers convert to int, letters into str, and "True" into True. I have problem with that True, now the result is [2, True, 'abcrue'] what condition should be used on "True" ?</p>