Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31031

Re: string contains and special characters

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <malaclypse2@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'attribute': 0.05; 'method.': 0.05; 'preferably': 0.05; 'escape': 0.07; 'function,': 0.07; 'subject:characters': 0.09; 'subject:string': 0.09; '(something': 0.16; 'getting,': 0.16; 'jerry': 0.16; 'oct': 0.16; 'reproduce': 0.16; 'string': 0.17; 'wrote:': 0.17; 'string,': 0.17; 'trying': 0.21; 'assuming': 0.22; 'seems': 0.23; 'header:In- Reply-To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'lines': 0.28; 'error': 0.30; 'code': 0.31; 'received:209.85.160.46': 0.32; 'getting': 0.33; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'text': 0.34; 'wrong': 0.34; 'received:209.85': 0.35; 'but': 0.36; 'should': 0.36; 'enough': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'help': 0.40; 'your': 0.60; 'containing': 0.61; 'telling': 0.61; "you'll": 0.62; 'solve': 0.62; 'provide': 0.62; 'seeing,': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=DDq/O2hSWP6oAzX0x0Ln5l+RFxOIVFhAuU443PgJ5Aw=; b=Bcd1Ng4m/DJGcNEpa5Y+hbm7OvT8Y+3BMjWTjcsfChpiGuV7ZKKAojJRfQZFmfSsY4 9mJvTo22eQzzaOaAIt078kdWrskkLf7yG+4NB5FWBDKs0dxGxMADeno07j6fy9dOMzit 5T4qJQf5+yrF4puAPvjQfxL0HVkY50EiS2xoRb/kntU/pGe0RV0vSAGgyGgqkndHfaUL 2Povy6hGif9g2mrXox8KIl3rdiF/ADAaGiWu0ZWX7DK6+fgcKlwJabP3001WLOBN4Wf6 KvdO1sLZnlF1IP3FFE3My+mfZSe3gJhToYzvtBRv2ySYNn/Ccr/J1k7yTr2MB8PnrLIb nsSQ==
MIME-Version 1.0
In-Reply-To <a6a8b018-f7d1-43ae-bee8-a2f2028866f1@googlegroups.com>
References <a6a8b018-f7d1-43ae-bee8-a2f2028866f1@googlegroups.com>
Date Tue, 9 Oct 2012 10:34:17 -0400
Subject Re: string contains and special characters
From Jerry Hill <malaclypse2@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2002.1349793260.27098.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1349793260 news.xs4all.nl 6967 [2001:888:2000:d::a6]:57287
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:31031

Show key headers only | View raw


On Tue, Oct 9, 2012 at 10:02 AM, loial <jldunn2000@gmail.com> wrote:
> I am trying to match a string that containing the "<" and ">" characters, using the string contains function, but it never seems to find the lines containing the string
>
> e.g if mystring.contains("<TAG>") :
>
> Do I need to escape the characters...and if so how?

Strings don't have a contains() method.  Assuming that mystring is
actually a string, you should be getting a very specific error,
telling you exactly what's wrong with your code (something like
AttributeError: 'str' object has no attribute 'contains').

If that isn't what you're seeing, you'll need to provide the full and
complete text of the error you are getting, and preferably enough of
your code that we can reproduce the issue and help you solve it.

-- 
Jerry

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

string contains and special characters loial <jldunn2000@gmail.com> - 2012-10-09 07:02 -0700
  Re: string contains and special characters Agon Hajdari <agonh@freenet.de> - 2012-10-09 16:10 +0200
    Re: string contains and special characters loial <jldunn2000@gmail.com> - 2012-10-09 08:09 -0700
    Re: string contains and special characters loial <jldunn2000@gmail.com> - 2012-10-09 08:09 -0700
  Re: string contains and special characters Dave Angel <d@davea.name> - 2012-10-09 10:23 -0400
  Re: string contains and special characters Jerry Hill <malaclypse2@gmail.com> - 2012-10-09 10:34 -0400
  Re: string contains and special characters Dave Angel <d@davea.name> - 2012-10-09 10:34 -0400
  Re: string contains and special characters Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-09 15:50 +0100
  Re: string contains and special characters Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-10-09 16:59 +0200

csiph-web