# -*- coding: utf-8 -*- from subprocess import check_output, STDOUT def list_files_and_folders(path, hiddens=True): output = check_output(['ls', '-a', path], stderr=STDOUT) items = [] for item in output.split('\n'): if item == '' or item == '.' or item == '..': continue if not hiddens and item.startswith('.'): continue items.append(item) return items def execute(command=[]): return check_output(command, stderr=STDOUT)