• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(3923)  |  Call(3801)  |  Derive(0)  |  Import(122)
find(s, sub [,start [,end]]) -> in

Return the lowest index in s where substring sub is found,
such that sub is contained within s[start,end].  Optional
arguments start and end are interpreted as in slice notation.

Return -1 on failure.

        def find(s, *args):
    """find(s, sub [,start [,end]]) -> in

    Return the lowest index in s where substring sub is found,
    such that sub is contained within s[start,end].  Optional
    arguments start and end are interpreted as in slice notation.

    Return -1 on failure.

    """
    return s.find(*args)
        


src/c/l/clearsilver-0.10.1/clearsilver/python/examples/base/wordwrap.py   clearsilver(Download)
 
  while i<ltext:
    if i+cols < ltext:
      r = string.find(text, "\n", i, i+cols)
      j = r
      if r == -1:
        j = string.rfind(text, " ", i, i+cols)
        if j == -1:
          r = string.find(text, "\n", i+cols)
          if r == -1: r = ltext
	  j = string.find(text, " ", i+cols)

src/c/l/clearsilver-0.10.1/clearsilver/python/examples/trans/trans.py   clearsilver(Download)
        # if we had state from the last parse... find it
        if self._html_state:
            if self._html_state == 2:
                x = string.find(data[i:], '-->')
                l = 3
            else:
                x = string.find(data[i:], '>')
                l = 1
            if x == -1: return results
            i = i + x + l
            self._html_state = 0
        while i < n:
            if DEBUG: print "MATCHING>%s<MATCHING" % data[i:]
            cmt_b = string.find(data[i:], '<!--')
        while i < n:
            if DEBUG: print "MATCHING>%s<MATCHING" % data[i:]
            cmt_b = string.find(data[i:], '<!--')
            cmt_e = string.find(data[i:], '-->')
            tag_b = string.find(data[i:], '<')
            tag_e = string.find(data[i:], '>')
            if DEBUG: print "B> %d %d %d %d <B" % (cmt_b, cmt_e, tag_b, tag_e)
            m = Translator._CS_TAG_RE.search(data, i)
            if not m:
                # search for a partial...
                x = string.find(data[i:], '<?')
                if x == -1:
                    results.append((data[i:], i))
                else:

src/d/j/django-navbar-0.3.0/examples/dbgp/_logging/__init__.py   django-navbar(Download)
        formatException() and appended to the message.
        """
        record.message = record.getMessage()
        if string.find(self._fmt,"%(asctime)") >= 0:
            record.asctime = self.formatTime(record, self.datefmt)
        s = self._fmt % record.__dict__
        if record.exc_info:
            return 1
        elif self.name == record.name:
            return 1
        elif string.find(record.name, self.name, 0, self.nlen) != 0:
            return 0
        return (record.name[self.nlen] == ".")
 
    def _fixupChildren(self, ph, alogger):
        """
        Ensure that children of the placeholder ph are connected to the
        specified logger.
        """
        for c in ph.loggers:
            if string.find(c.parent.name, alogger.name) <> 0:

src/c/l/clearsilver-0.10.1/clearsilver/python/examples/base/odb.py   clearsilver(Download)
                try:
                    cursor.execute(sql)
                except Exception, reason:
                    if string.find(str(reason), "Duplicate entry") != -1:
                        raise eDuplicateKey, reason
                    raise Exception, reason
                a_row.markClean()
        except Exception, reason:
          # sys.stderr.write("errror in statement: " + sql + "\n")
          log("error in statement: " + sql + "\n")
          if string.find(str(reason), "Duplicate entry") != -1:
            raise eDuplicateKey, reason
          raise Exception, reason
 

src/b/e/beatbox-19.0/examples/soql2atom.py   beatbox(Download)
def addRequiredFieldsToSoql(soql):
	findPos = string.find(string.lower(soql), "from")
	selectList = []
	for f in string.lower(soql)[:findPos].split(","):
		selectList.append(string.strip(f))
	if not "id" in selectList: selectList.append("Id")
	if not "systemmodstamp" in selectList: selectList.append("systemModStamp")

src/e/d/Edwin-HEAD/scripts/msg/examples/pyqtjab.py   Edwin(Download)
    def presenceCB(self, con, prs):
        who = str(prs.getFrom())
        i = string.find(who, '/')
        status = str(prs.getStatus())
 
        if i > 0:
            self.rosterList.addUser(who[:i], status)
    def messageCB(self, con, msg):
        sender = str(msg.getFrom())
 
        i = string.find(sender, '/')
        if i > 0:
            sender = sender[:i]
 
 
        if cw:
            source = str(msg.getFrom())
            i = string.find(source, '/')
            if i:
                source = source[i+1:]
 

src/m/i/microview-HEAD/MicroView/trunk/MicroView/Plugins/Current/ResampleImage.py   microview(Download)
        # promote default extension to the top of the list
        pos = -1
        for i in range(len(ft)):
          if string.find(ft[i][1], self._default_write_extension) != -1:
              pos = i
              if (pos != -1):
                  temp = [ft[pos]]

src/d/j/django-navbar-0.3.0/examples/dbgp/_logging/handlers.py   django-navbar(Download)
            url = self.url
            data = urllib.urlencode(self.mapLogRecord(record))
            if self.method == "GET":
                if (string.find(url, '?') >= 0):
                    sep = '&'
                else:
                    sep = '?'

src/p/k/pksampler-HEAD/scosc/OSC.py   pksampler(Download)
def readString(data):
    length   = string.find(data,"\0")
    nextData = int(math.ceil((length+1) / 4.0) * 4)
    return (data[0:length], data[nextData:])
 
 
def readBlob(data):
        interpretation = None
        try:
            interpretation = float(arg)
            if string.find(arg, ".") == -1:
                interpretation = int(interpretation)
        except:
            # Oh - it was a string.

src/b/e/beatbox-19.0/examples/export.py   beatbox(Download)
def export(username, password, objectOrSoql):
	svc.login(username, password)
	if string.find(objectOrSoql, ' ') < 0:
		soql = buildSoql(objectOrSoql)
	else:
		soql = objectOrSoql
 

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next