Message144278
This is self-explanative. Function definitions are identical. Syntax error caused by the absence of empty line after the function definition.
Python 2.7.1 (r271:86832, Apr 12 2011, 16:16:18)
[GCC 4.6.0 20110331 (Red Hat 4.6.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> def get_size(start_path = '.'):
... total_size = 0
... for dirpath, dirnames, filenames in os.walk(start_path):
... for f in filenames:
... fp = os.path.join(dirpath, f)
... total_size += os.path.getsize(fp)
... return total_size
...
>>> print get_size()
1595969238
>>> def get_size(start_path = '.'):
... total_size = 0
... for dirpath, dirnames, filenames in os.walk(start_path):
... for f in filenames:
... fp = os.path.join(dirpath, f)
... total_size += os.path.getsize(fp)
... return total_size
... print get_size()
File "<stdin>", line 8
print get_size()
^
SyntaxError: invalid syntax |
|
Date |
User |
Action |
Args |
2011-09-19 14:21:25 | techtonik | set | recipients:
+ techtonik |
2011-09-19 14:21:24 | techtonik | set | messageid: <1316442084.93.0.49113454288.issue13008@psf.upfronthosting.co.za> |
2011-09-19 14:21:24 | techtonik | link | issue13008 messages |
2011-09-19 14:21:23 | techtonik | create | |
|