I am using WC -l to count number of lines in a text document. However I got a problem here.
I got a python code that wrote different combination of numbers into different files. each file contain each number of the combination on a separate line.
When I use wc -l for it, it didnt count the last line!
below is the python code:
import os
import itertools
lst = [6,7,8,9,12,19,20,21,23,24,26,27,28,29,43,44]
combs = []
for i in xrange(1, len(lst)+1):
els = [list(x) for x in itertools.combinations(lst, i)]
combs.extend(els)
for combination in els:
combination_as_strings = map(str, combination)
filename = "_".join(combination_as_strings) + ".txt"
filename = os.path.join("Features", filename)
with open(filename, 'w') as output_file:
output_file.write("\n".join(combination_as_strings))
Thanks in advance,
Ahmad