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


Groups > comp.lang.python > #45928

Re: Prepending string "@" to usernames

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python.list@tim.thechases.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.069
X-Spam-Evidence '*H*': 0.87; '*S*': 0.01; 'subject:string': 0.09; 'cc:addr:python-list': 0.11; '-tkc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'wrote:': 0.18; 'written': 0.21; 'cc:addr:gmail.com': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**1': 0.23; 'header:In-Reply-To:1': 0.27; 'charset:us-ascii': 0.36; 'list': 0.37; 'thank': 0.38; 'address': 0.63; 'thomas': 0.65; 'to:addr:gmail.com': 0.65; 'dan.': 0.84; 'perfect!': 0.84; 'received:50.22': 0.84
Date Fri, 24 May 2013 18:19:40 -0500
From Tim Chase <python.list@tim.thechases.com>
To Thomas Murphy <thomasmurphymusic@gmail.com>
Subject Re: Prepending string "@" to usernames
In-Reply-To <CAEcwjcyFYMg6sxND7XE6cKOkab3HB2nA89CBJLp2Cq9g5F3h-A@mail.gmail.com>
References <CAEcwjcx6WtUMTg=QpqjEZ3fyfUhOLWQ2v-pF4qQ9ypFd3DtByA@mail.gmail.com> <CAGGBd_okY709NyG0BBZSHzv709oTAUNbicMgfOMjo3LjFDipwQ@mail.gmail.com> <CAEcwjcyFYMg6sxND7XE6cKOkab3HB2nA89CBJLp2Cq9g5F3h-A@mail.gmail.com>
X-Mailer Claws Mail 3.7.6 (GTK+ 2.20.1; x86_64-pc-linux-gnu)
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - boston.accountservergroup.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - tim.thechases.com
Cc Python <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.2087.1369437469.3114.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369437469 news.xs4all.nl 15900 [2001:888:2000:d::a6]:54124
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45928

Show key headers only | View raw


On 2013-05-24 19:04, Thomas Murphy wrote:
>> raw_address = "cookielover93 TheGermanHatesSaurkraut
>> WhatsThatBoy932834" address_library = raw_address.split()
>> print address_library
>>
>> final_address = []
>> for address in address_library:
>>     final_address.append("@" + str(address))
>> print final_address
>>
> Exactly it. Thank you so much Dan. Perfect!

Which can be tidily written as a list comprehension:

  final_address = ['@' + address for address in raw_address.split()]

-tkc

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


Thread

Re: Prepending string "@" to usernames Tim Chase <python.list@tim.thechases.com> - 2013-05-24 18:19 -0500

csiph-web