vodkadrinker
Technical User
I am trying to find a string in a list element.
example data
So from the data I want to find any line with "abc.bob" and then just count the number of them.
The data is read into a list called "info"
This is the example code that I am trying
But this does not find the string in the line, please can someone point me in the right direction.
To add to this when I use the same code and read in the data from a file it works fine, but I am working with
someone else's code and they read it into list.
example data
Code:
'/home/myfiles/abc.bob/a file'
'/home/myfiles/abc.bob/b file'
'/home/myfiles/bbb.bob/a file'
So from the data I want to find any line with "abc.bob" and then just count the number of them.
The data is read into a list called "info"
This is the example code that I am trying
Python:
for line in info:
if 'abc.bob' in line:
abc_count += 1
But this does not find the string in the line, please can someone point me in the right direction.
To add to this when I use the same code and read in the data from a file it works fine, but I am working with
someone else's code and they read it into list.