By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,630 Members | 1,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,630 IT Pros & Developers. It's quick & easy.

How to use findall to find keywords in file

P: n/a
I'm new to python and was trying to write a (re.findall) code to find stings containing a certain keyword in my file.

This is the code I'm using and I'm getting error messages??? Please help..

>>> lines=q6.readlines()
>>> for i in lines:
... element = re.findall('[^\+\n]+' i),,,,,error message
if element[2]=='chr22'
Oct 1 '10 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 2.5K+
P: 2,851
You left out the comma between the pattern and string arguments.
Oct 1 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.