Friday, 23 August 2013

Python TypeError on For Loop

Python TypeError on For Loop

So I'm new to Python, but I see no reason why this shouldn't work:
def pathup(path, n):
for i in range(n):
path = os.path.dirname(path)
return path
It gives TypeError: 'int' object is not iterable on the for loop line. Any
ideas? I'm using Python 2.7.5.

No comments:

Post a Comment