ronenness / grepfunc Goto Github PK
View Code? Open in Web Editor NEWSimple grep-like function for Python.
License: MIT License
Simple grep-like function for Python.
License: MIT License
Hi,
StopIteration Traceback (most recent call last)
~\Anaconda3\lib\site-packages\grepfunc\grepfunc.py in grep_iter(target, pattern, **kwargs)
234 # done iteration
--> 235 raise StopIteration
236
StopIteration:
The above exception was the direct cause of the following exception:
RuntimeError Traceback (most recent call last)
in
6
7 # print all people with first name 'Bob'
----> 8 for POT in grep_iter(infile, "WPOT_TOTAL2"):
9 print (POT)
RuntimeError: generator raised StopIteration
It might need to end loop when the codes read the end of the line?
\https://pythonhosted.org/grepfunc/
Read the Grep on File section:
The following example will return a list of movie names without the word 'dog' in them, read from a file.
Yet, the actual code is as below:
from grepfunc import grep
infile = open('movies.txt', 'r')
grep(infile, "dog", i=True)
Note two things:
While this seems trivial, this puts the average user who is simply trying to grep through a file with python into a confusing quest to understand why the results are backwards.
Two fixes needed: Both the high level description and the comment in the code need to say that we are looking for the movie names WITH the word Dog in them.
Hello. I was looking for something similar to grep and came across to your project.
Unfortunately, it doesnt seem to work with Python 3.
When I tried
from grepfunc import grep
I got:
In [56]: from grepfunc import grep
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-56-5f3ea5e5b70f> in <module>()
----> 1 from grepfunc import grep
c:\python\python36\lib\site-packages\grepfunc\__init__.py in <module>()
8 __license__ = 'MIT'
9
---> 10 from grepfunc import (grep, grep_iter)
11
ImportError: cannot import name 'grep'
I have had this error:
File ".\wpy64\python-3.8.5.amd64\lib\sre_parse.py", line 668, in _parse
# raise source.error("nothing to repeat",
error: nothing to repeat
Any idea?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.