Without looping:
with open(file, 'r') as f:
print(len(f.split('\n')[34].split()))
solved Python: number of words in line [duplicate]
Without looping:
with open(file, 'r') as f:
print(len(f.split('\n')[34].split()))
solved Python: number of words in line [duplicate]