I'm currently working on python code to extract a specific strings on a text file between ' '
. Here's the code I'm working on:
import re
pattern = "(\w+'*',)"
with open('C:\Documents and Settings\Ash\Desktop\strcount.txt', "r") as text:
for line in text:
print re.findall(pattern, line)
and the list of strings in the text file
('FLBC8U', 24)
('cHvQuW', 24)
('7FDm@', 24)
('15ii?', 24)
('H!oDe', 24)
('RB6#U', 24)
('uAmer', 24)
('6NmDJ', 24)
('d-MS1', 24)
('Ejf&B', 24)
I only wanted to take the string in the middle of ' '
single quotation mark before the comma ,
so the number and the bracket is ignored