Feb-28-2020, 12:10 AM
Hi, I want to do these steps.
1) Spit a string into an array by spaces
2) Check if each array element is a number
The isinstance(variable, int) function works if I make the array myself. But if I split the array like the code below, it doesn't. Any ideas?
stringA = "donkey 2 pirate"
SplitArray = stringA.split(" ")
for bb in SplitArray:
print(isinstance(bb, int));
1) Spit a string into an array by spaces
2) Check if each array element is a number
The isinstance(variable, int) function works if I make the array myself. But if I split the array like the code below, it doesn't. Any ideas?
stringA = "donkey 2 pirate"
SplitArray = stringA.split(" ")
for bb in SplitArray:
print(isinstance(bb, int));