question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

select_one and select

See original GitHub issue

I like the function soup.select() and soup.select_one(). Maybe you can add select_one to this repo? If the result is None, I can easily know that there are no match objects. Just like https://docs.python.org/3/library/re.html#re.search Infact, I don’t know why you use limit to control the number of the results. I think people would need one or all of the results.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
facelessusercommented, Dec 27, 2018

Had a little time this morning, so I implemented the feature via #46. It will be in the 1.5.0 release. Not sure when that release is coming yet. Maybe not too far out. I imagine major releases will slow down moving forward as I feel the project has a solid feature base now, but I think I’ll at least get this one out within the week.

1reaction
facelessusercommented, Dec 27, 2018

And thanks for the css seletors you invented, like !=, that is what I need now.

Well, I didn’t ivent it, it was something other libraries have been using for a while. I know JQuery and the lxml CSSSelect library implement it. It seemed too logical and convenient not to add here as well.

I like the precompile. It looks like the re module (re.compile).

Yeah, that was kind of my model when I wrote it. Seemed like if you had a script with known things you were looking for, instead of calling select over and over, and reparsing the selector string and building the search object, it would be best to:

  1. Allow you to build that thing once and reuse it.

  2. Cache them in case you didn’t think to precompile it to begin with.

Both of these the re module employs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SelectOne | Professional Recruiting & Staffing Firm
Smarter recruiting knows the difference between filling and fitting. We put people and technology to work together to help your organization grow.
Read more >
Selectone select paint and primer all in one - Exclusive Paints
A low voc interior/exterior all in one paint and primer, offering excellent durability and adhesion. 100% acrylic formula. Select 100% Acrylic is suitable...
Read more >
SelectOne Network
dba Select Marketing Services, Inc. P.O. Box 16267. Savannah, GA 31416. Serving the Southeastern United States. (912) 667-0441 (800) 662-6992
Read more >
SelectONE | ShawContract
SelectONE is a quick ship collection that combines our design and segment expertise to solve your needs for high-performing, budget-driven choices.
Read more >
selectOne - Select One - IBM
Specifies whether to limit selection to one item. Category. basics. Syntax. selectOne="true|false". Usage. In Design mode, click All Properties and look for ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found