Skip to content
Kudithipudi.org

Kudithipudi.org

Too Much Time On Hand!!

Tag: notes

Posted on May 24, 2020

HOWTO : Python string search

Quick self-note 🙂

different ways to search for content in a string in python

  • Basic (and quickest)
    • if 'content' in string:
  • String.find (second quickest and doesn’t need additional module)
    • if string.find('content'):
  • re.match (uses regex engine, most powerful)
    • import re
    • if re.search('content', string)

Good discussion here : https://stackoverflow.com/questions/4901523/whats-a-faster-operation-re-match-search-or-str-find

Pages

  • Bookmarks
  • Ideas
  • Bucket List
    • Texas : Places to visit
  • Quotes
    • Quotes By Alok
    • Quotes by Vasanth
  • Running
    • 2008 Marathon : Running for Education
    • 2019 : Running Log
  • Resolutions
    • 2012 : 60 Day Resolution
    • 2019 : The year of discarding

Archives

Categories

Proudly powered by WordPress