I am trying to develop a python script that loops through a set of subdirectories I have and extracts a data file from each of those subdirectories. My subdirectories are each named for their corresponding time in a simulation I have fun earlier. However, the issue is that the integer subdirectories are listed without a decimal point (e.g. 5), while the non-integer subdirectories are listed with a decimal point. So in order to find the correct subdirectory, my loop is very sensitive to the number type.
With that, I have been trying to use the is._integer() method with python, but I keep getting this error:
'int' object has no attribute 'is_integer'
when I run the following code:
def frange(x, y, jump):
while x < y:
yield x
x += jump
time=15
for i in frange(0,time,0.1):
float(i)
print (i).is_integer()
even when I am brute forcing my loop variable to be a float! Please help.