Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31028
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <d@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'syntax': 0.03; 'ascii': 0.07; 'class,': 0.07; 'escape': 0.07; 'function,': 0.07; 'python': 0.09; 'subject:characters': 0.09; 'subject:string': 0.09; 'cc:addr :python-list': 0.10; 'language': 0.14; 'keyword.': 0.16; 'language?': 0.16; 'string': 0.17; 'wrote:': 0.17; 'versions': 0.20; 'trying': 0.21; 'error.': 0.21; 'cc:2**0': 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'lines': 0.28; 'str': 0.29; 'version': 0.34; 'except': 0.36; 'but': 0.36; 'characters': 0.36; 'method': 0.36; 'subject:: ': 0.38; 'received:192': 0.39; 'received:192.168': 0.40; 'containing': 0.61; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72 |
| Date | Tue, 09 Oct 2012 10:23:42 -0400 |
| From | Dave Angel <d@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
| MIME-Version | 1.0 |
| To | loial <jldunn2000@gmail.com> |
| Subject | Re: string contains and special characters |
| References | <a6a8b018-f7d1-43ae-bee8-a2f2028866f1@googlegroups.com> |
| In-Reply-To | <a6a8b018-f7d1-43ae-bee8-a2f2028866f1@googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:ctgZqWfHQK8G7asI4uUjfMdFa6qMbrn20TTTDZxvooY XG1fSsUDFBHUAJHu2Vru2iA6netHcmd5E/4F5lwluTO6qSK0Bc WAI5NacWTu0A65isBe5GP0askfbOcL5lxUrRCL/5S9Pj8EHo/z reU3wFhMJQ49hRO+DKIHjOKq4TF8EZuJshzCanRemBcGPanmuU 0JB1+ShoIblGH/s0ZWf7+bNLNX3YHMjPqe0To5k3rJW+s2izGT BMqk9DwEEOmSe7MNDXVEdNHMgEyaodS4fqsFNyy6YBNBaw+AOs PZeS0mhMOmmR2wxvKPLaTz+DlQ1zfcCABU/iQN0eEns3Eyy0g= = |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | d@davea.name |
| 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.1999.1349792644.27098.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1349792644 news.xs4all.nl 6897 [2001:888:2000:d::a6]:50293 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:31028 |
Show key headers only | View raw
On 10/09/2012 10:02 AM, loial 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?
>
What language are you trying to use, and what version of that language?
In all the Python versions I know of, that line would simply be a syntax
error. There's no "contains" method in the str class, use the 'in' keyword.
if "<TAG>' in mystring:
No need to escape any ASCII characters except backslash.
--
DaveA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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