问题 I have a text files that I read to a list. This list contains integers and strings. For example, my list could look like this: ["name", "test", "1", "3", "-3", "name" ...] Now, I want to convert all numbers into integers using the .isdigit() method or the isinstance() function. for example: for i in range len(mylist): if mylist[i].isdigit(): mylist[i] = int(mylist[i]) The problem is that "-3".isdigit() for example would return False . Any tips for a simple solution to circumvent the problem