I am attempting to write a code for class and was having trouble with the end and
Fantastic news! We've Found the answer you've been seeking!
Question:
I am attempting to write a code for class and was having trouble with the end and ran across this as a solution:
for file in os.listdir(cats_path):
print('{0} : {1} bytes'.format(file, os.path.getsize(cats_path / file)))
I am trying to list to contents of a folder in bytes. When attempting this code, I am getting this error:
line 24, in
print('{0} : {1} bytes'.format(file, os.path.getsize(cats / file)))
TypeError: unsupported operand type(s) for /: 'str' and 'str'
Can you tell what I am doing wrong?
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date: