Created
November 8, 2018 11:34
-
-
Save osoda/69f21664352a55540ec18781c0ab7119 to your computer and use it in GitHub Desktop.
Give a multiple lists in ouput file, whit the files in a dir; every list have a static amount files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os, math | |
for root, dirs, files in os.walk("./manual"): | |
n = int(input(raw_input("Ingrese el numero de archivos en el que se particionara: "))) | |
dbs = '' | |
length =len(files) | |
cantArchives = int(math.ceil(float(length)/n)) | |
print(str(length)+' nombres de db seran guardadas en '+str(cantArchives)+' archivos') | |
for i,filename in enumerate(files, start=1): | |
dbs +=filename+'\n' | |
if(i%n==0 or i==length): | |
x = int(math.ceil(float(i)/n)) | |
f = os.path.join(root,filename) | |
a = open("outputs/dbs%s.txt" %x,"w") | |
a.write(str(dbs)) | |
print(dbs+ str(x)) | |
dbs = '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment