Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41526
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <joel.goldstick@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'subject:Python': 0.05; 'tom': 0.07; 'python': 0.09; '"\\n")': 0.09; 'python:': 0.09; 'skip:\\ 30': 0.09; 'cc:addr:python-list': 0.10; 'need:': 0.16; 'subject:values': 0.16; '\xc2\xa0i': 0.16; 'wrote:': 0.17; 'basically': 0.17; 'replacing': 0.17; '>>>': 0.18; 'email addr:gmail.com>': 0.20; 'equivalent': 0.20; 'all,': 0.21; '>>>': 0.22; 'cc:2**0': 0.23; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'skip:[ 10': 0.26; 'values': 0.26; 'am,': 0.27; 'appreciated': 0.27; 'replace': 0.27; 'message-id:@mail.gmail.com': 0.27; 'url:mailman': 0.29; '8bit%:5': 0.29; 'skip:& 10': 0.29; 'e.g.': 0.30; 'url:python': 0.32; 'print': 0.32; 'url:listinfo': 0.32; 'harry': 0.33; 'skip:l 40': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'subject:" ': 0.36; 'subject:with': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'help': 0.40; 'url:mail': 0.40; 'your': 0.60; 'skip:\xc2 10': 0.62; 'assistance': 0.63; 'skip:n 10': 0.63; 'dear': 0.66; 'as:': 0.75; '2013': 0.84; '[name]': 0.84; 'leo': 0.84; 'joel': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=DwM7vhuff3vcGFkXuiSKbdObvNuNTayuVqXHX7eVRHg=; b=DflWlniCSsEv2fIN1MW6ErfRzGbx3z82KCE5WlsDjMpqiLBpYYogIiJLwWilY3wany xCoBeNqd4xBkVw0NlI0gP71aTmIgvCiNuE0x8+uFcD8klvv2X4dIUDdo0Wq2wFugQgiW opD6KsEbY12lPZ/03ZCLRNgGW+U/Uy4Q18retbR/+Dt3Wi38tcsB5u9cmY6XGmH+V5jN BYtx4g9CTT/vNXH/pUgfEZ+65qH8VrKRKYMPVp5MZ3EJilgCHugK7iXgnpx1m/4hbuqC KkKwSZzg4dFF2Zv9MpKvu0HkoLENcKC3ZpERn6fOQPX4xVyvdhW+6Az8Vk1m8bu/v717 10/w== |
| MIME-Version | 1.0 |
| X-Received | by 10.220.119.147 with SMTP id z19mr3163439vcq.69.1363708234646; Tue, 19 Mar 2013 08:50:34 -0700 (PDT) |
| In-Reply-To | <CAFrZharU4-mgKmb_UmS-tsk-m7i0Jtr=OiTPMc-OxVo45MT-Vw@mail.gmail.com> |
| References | <CAFrZharU4-mgKmb_UmS-tsk-m7i0Jtr=OiTPMc-OxVo45MT-Vw@mail.gmail.com> |
| Date | Tue, 19 Mar 2013 11:50:34 -0400 |
| Subject | Re: Replace "dash" values in a field with new line- VB equivalent of Python |
| From | Joel Goldstick <joel.goldstick@gmail.com> |
| To | Cathy James <nambo4jb@gmail.com> |
| Content-Type | multipart/alternative; boundary=bcaec54d4cfce77f7a04d8491067 |
| Cc | "python-list@python.org" <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.3522.1363708242.2939.python-list@python.org> (permalink) |
| Lines | 91 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1363708242 news.xs4all.nl 6843 [2001:888:2000:d::a6]:45764 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:41526 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On Tue, Mar 19, 2013 at 11:36 AM, Cathy James <nambo4jb@gmail.com> wrote:
> Dear All,
> I need some assistance with Python so that values in the "Name" field e.g.
> Murray - James - Leo can be labeled as:
>
> Murray
> James
> Leo
>
> with a new line replacing every dash.
>
> Basically I need the equivalent of this VB in Python:
> replace ( [Name] , "-", vbNewLine)
>
> I tried this but no luck:
>
> str.[Name].replace("-", "\n")
> str.[Name].replace("-", \n)
> [Name].replace("-", \n")
>
> Your help is appreciated
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
> Is this what you need:
>>> names = 'Tom - Dick - Harry'
>>> name_list = names.split('-')
>>> name_list
['Tom ', ' Dick ', ' Harry']
>>> name_list = names.split('-')
>>> for n in name_list:
... print n.strip()
...
Tom
Dick
Harry
>>>
--
Joel Goldstick
http://joelgoldstick.com
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Replace "dash" values in a field with new line- VB equivalent of Python Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-19 11:50 -0400
csiph-web