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


Groups > comp.lang.python > #38977

Re: Howto parse a string using a char in python

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <gwchamb@gwcmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:string': 0.09; 'subject:using': 0.09; 'cc:addr:python-list': 0.10; 'subject:python': 0.11; '":"': 0.16; 'enough.': 0.16; 'function(s)': 0.16; 'string': 0.17; 'parse': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'colon': 0.29; 'python2.7': 0.29; 'character': 0.29; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'skip:" 10': 0.40; 'header:Message-Id:1': 0.62; 'sounds': 0.71; 'received:108': 0.91
Subject Re: Howto parse a string using a char in python
Mime-Version 1.0 (Mac OS X Mail 6.2 \(1499\))
Content-Type multipart/signed; boundary="Apple-Mail=_D6780072-277F-4DB6-B5B1-1561BE9B8E1E"; protocol="application/pkcs7-signature"; micalg=sha1
From Gary Chambers <gwchamb@gwcmail.com>
X-Priority 3
In-Reply-To <511ebf0c$0$21334$9a6e19ea@unlimited.newshosting.com>
Date Fri, 15 Feb 2013 18:13:21 -0500
References <511ebf0c$0$21334$9a6e19ea@unlimited.newshosting.com>
To Steve Goodwin <sgoodwin@cfl.rr.com>
X-Mailer Apple Mail (2.1499)
Cc python-list@python.org
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.1860.1360970443.2939.python-list@python.org> (permalink)
Lines 80
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1360970443 news.xs4all.nl 6988 [2001:888:2000:d::a6]:44377
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38977

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Steve,

> I am looking for the python2.7 function(s) to parse a string from a colon 
> character ":"
> 
> Sounds simple enough.
> 
> For example, a string like "123456:789".  I just need the "123456" 
> substring.(left of the :)

How about:

newstr = str[:str.find(':')]

--
GC

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


Thread

Howto parse a string using a char in python "Steve Goodwin" <sgoodwin@cfl.rr.com> - 2013-02-15 18:04 -0500
  Re: Howto parse a string using a char in python John Gordon <gordon@panix.com> - 2013-02-15 23:11 +0000
  Re: Howto parse a string using a char in python Tim Chase <python.list@tim.thechases.com> - 2013-02-15 17:16 -0600
  Re: Howto parse a string using a char in python David Robinow <drobinow@gmail.com> - 2013-02-15 18:19 -0500
  Re: Howto parse a string using a char in python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-02-15 23:20 +0000
  Re: Howto parse a string using a char in python Gary Chambers <gwchamb@gwcmail.com> - 2013-02-15 18:13 -0500

csiph-web