I have a list of data that I want to search through. This new list of data is structured like so.
name, address dob family members age height etc..
I want to search through the lines of data so that I stop the search at the ',' that appears after the name to optimize the search. I believe I want to use this command:
str.find(sub[, start[, end]])
I'm having trouble writing the code in this structure though. Any tips on how to make string find work for me?
Here is some sample data:
Bennet, John, 17054099","5","156323558","-","0", 714 //
Menendez, Juan,7730126","5","158662525" 11844 //
Brown, Jamal,"9","22966592","+","0",,"4432 //
The idea is I want my program to search only to the first ',' and not search through the rest of the large lines.
EDIT. So here is my code.
I want the to search the lines in completedataset only until the first comma. I'm still confused as to how I should implement these suggestions into my existing code.
counter = 1
for line in completedataset:
print counter
counter +=1
for t in matchedLines:
if t in line:
smallerdataset.write(line)