473,394 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to use findall to find keywords in file

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..

q6=open('file1.txt','r')
>>> lines=q6.readlines()
>>> for i in lines:
... element = re.findall('[^\+\n]+' i),,,,,error message
if element[2]=='chr22'
Oct 1 '10 #1
1 2204
bvdet
2,851 Expert Mod 2GB
You left out the comma between the pattern and string arguments.
Oct 1 '10 #2

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

Similar topics

2
by: disgracelands | last post by:
I've been looking at using python and it's been going fairly well so far, i can call C from python and python from C fine but now i've hit a snag and i'm wondering how you guys have got around it....
17
by: bearophileHUGS | last post by:
Hello, I know this topic was discussed a *lot* in the past, sorry if it bores you... >From the Daily Python-URL I've seen this interesting Floating Point Benchmark:...
11
by: blah | last post by:
Need python Pro at newtopython@googlegroups.com , if u wanna help, plz reply to that address. We are python beginners. need a real good Python Programmer for Help. TIA!! -- * Posted with...
3
by: stuart_white_ | last post by:
I've just upgraded from Python 2.3.3 to Python 2.4.2, and, although the new version of Python seems to be running correctly, I can't seem access the help from the interpreter. On Python 2.3.3...
0
by: Sundown | last post by:
Hello... This is my first time posting. One of my co workers told me this is the place to be for help on these kinds of situations. Anyhow this is what I got: I am trying to make a simple anti...
10
by: Elric02 | last post by:
I'm currently trying to get access to the Python source code, however whenever I try to extract the files using the latest version of WinZip (version 10) I get the following error "error reading...
9
by: John Zenger | last post by:
To my horror, someone pointed out to me yesterday that a web app I wrote has been prominently displaying a misspelled word. The word was buried in my code. Is there a utility out there that...
5
by: xkenneth | last post by:
Hi All, I'll shortly be distributing a number of python applications that use proprietary. The software is part of a much larger system and it will need to be distributed securely. How can i...
2
by: WP | last post by:
Hello, below is my very first python program. I have some questions regarding it and would like comments in general. I won't be able to get my hands on a good python book until tomorrow at the...
8
by: toanmh | last post by:
I have code to unwrap package. But i don'nt know python language. Please help me to convert this code to C# or Java. Thanks for help.! import re import base64 import zlib import sys #...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.