Python list contents error [duplicate]

You need to indent your code properly:

import os
for x in os.listdir("/home/"):
    print x

Leave a Comment