I am trying to retrieve the number of lines of a file using python on ubuntu.
I tried the following:
os.system("wc -l fileName")
But it returns something like
numberOfLines fileName
0
When I tried to retrieve the result: l = os.system("wc -l fileName")
I got l = 0
I also tried to split the result in order to keep the first element only, but this raises AttributeError: 'int' object has no attribute 'split'
How can I get the number of lines I am looking for?