Search N Act
Project description
Search N Act
you can do:
search and replace
search and create
search and open
search and anything...
Sample Usage
you can see the code samples
sample.txt
hello, world!
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
sample.py
from sna.search import Sna
sna = Sna()
@sna("(.*d.*r.*)")
class DR_word(object):
def __init__(self, match):
self.content = match.group(1)
def read(self):
print(self.content)
@sna("(.*e.*t.*)")
class ET_word(object):
def __init__(self, match):
self.content = match.group(1)
def read(self):
print(self.content)
# find all patterns
sna.search().through.words().on(
filepath="sample.txt"
).read()
print(80 * "-")
# Or be specific
sna.search("ET_word").through.words().on(
filepath="sample.txt"
).read()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sna-0.0.7.tar.gz
(2.9 kB
view hashes)