jl487
0
Newbie Poster
Recommended Answers
Jump to Postfirst: Why shell out to the system to get pattern matching when python offers the re package?
second: call it like this:os.system("grep %s sample.txt"%variable)
Jump to PostAnd you have to supply the path unless sample.txt is in your PYTHONPATH.
os.system("grep %s ./sample.txt" % variable) ## current directory
All 5 Replies
griswolf
304
Veteran Poster
woooee
814
Nearly a Posting Maven
jl487
0
Newbie Poster
griswolf
304
Veteran Poster
TrustyTony
888
pyMod
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.