I actually have two questions.
lines = file.readlines()
1.) Is variable lines a list?
2.) How to see how many elements are there in a list?
Thank you very much :D
I actually have two questions.
lines = file.readlines()
1.) Is variable lines a list?
2.) How to see how many elements are there in a list?
Thank you very much :D
with open('p7.erl', 'r') as f:
lines = f.readlines()
print type(lines)
print len(lines)
outputs:
<type 'list'>
27
so yes, lines is a list and you can find out how many elements are in the by len
function.
If you are only interested in number of lines in a file see this