Skip to content

Instantly share code, notes, and snippets.

@brunoperezm
Created July 21, 2012 16:37
Show Gist options
  • Save brunoperezm/3156359 to your computer and use it in GitHub Desktop.
Save brunoperezm/3156359 to your computer and use it in GitHub Desktop.
Loop files in folder
import os
folder = raw_input('Dime la carpeta: \n')
lista = os.listdir(folder)
text_file = os.open('./lista_de_archivos.txt',os.O_CREAT|os.O_RDWR)
for index in range(len(lista)):
os.write(text_file, str(index) + ' ' + lista[index] + '\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment