Skip to main content

Search N Act

Project description

Search N Act

github PyPi

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


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.6.tar.gz (2.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page