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


Groups > comp.lang.python > #38976

Re: Howto parse a string using a char in python

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
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; 'expressions': 0.07; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:string': 0.09; 'subject:using': 0.09; 'looked': 0.10; 'subject:python': 0.11; 'index': 0.13; 'steve': 0.13; '":"': 0.16; 'enough.': 0.16; 'function(s)': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'string': 0.17; 'wrote:': 0.17; 'parse': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'regular': 0.27; 'header:X-Complaints-To:1': 0.28; 'colon': 0.29; 'methods.': 0.29; 'python2.7': 0.29; 'character': 0.29; 'function': 0.30; 'url:python': 0.32; 'from:addr:yahoo.co.uk': 0.32; 'to:addr:python-list': 0.33; 'likely': 0.33; 'hi,': 0.33; 'received:org': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'thank': 0.36; 'far': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'you.': 0.61; 'more': 0.63; 'visit': 0.64; 'sounds': 0.71
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Howto parse a string using a char in python
Date Fri, 15 Feb 2013 23:20:06 +0000
References <511ebf0c$0$21334$9a6e19ea@unlimited.newshosting.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host host-92-22-84-96.as13285.net
User-Agent Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20130107 Thunderbird/17.0.2
In-Reply-To <511ebf0c$0$21334$9a6e19ea@unlimited.newshosting.com>
X-Antivirus avast! (VPS 130215-1, 15/02/2013), Outbound message
X-Antivirus-Status Clean
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.1859.1360970360.2939.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1360970360 news.xs4all.nl 6980 [2001:888:2000:d::a6]:42751
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38976

Show key headers only | View raw


On 15/02/2013 23:04, Steve Goodwin wrote:
> Hi,
>
> 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 :)
>
> I have looked at regular expressions and string functions, so far no luck.
> Custom function required?
>
> Thank you.
>
> - Spoog98
>
>

More likely a visit to the opticians :)  See 
http://docs.python.org/2/library/stdtypes.html#string-methods for the 
find and index methods.

-- 
Cheers.

Mark Lawrence

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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