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


Groups > comp.lang.python > #45923

Re: Prepending string "@" to usernames

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <drsalists@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.047
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'skip:[ 20': 0.04; 'output': 0.05; 'subject:string': 0.09; 'cc:addr:python-list': 0.11; '"@"': 0.16; '24,': 0.16; 'iterating': 0.16; 'usernames': 0.16; 'for?': 0.16; 'wrote:': 0.18; 'email addr:gmail.com&gt;': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'announcement': 0.30; 'skip:@ 10': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'code': 0.31; 'front': 0.32; 'text': 0.33; 'url:python': 0.33; 'fri,': 0.33; 'raw': 0.33; 'maybe': 0.34; "i'd": 0.34; 'one,': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'url:listinfo': 0.36; 'url:org': 0.36; 'turn': 0.37; 'list': 0.37; 'skip:& 10': 0.38; 'skip:[ 10': 0.38; 'list,': 0.38; 'pm,': 0.38; '\xa0\xa0\xa0': 0.39; 'url:mail': 0.40; 'manually': 0.60; 'tag': 0.61; "you're": 0.61; 'address': 0.63; 'real': 0.63; 'thomas': 0.65; 'to:addr:gmail.com': 0.65; 'beloved': 0.84; 'pasting': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=DN0bLukqdxU5rOZ1+TKqmk+4ei6FB6IaYSzD95ZcNo0=; b=09RhdR19pgDB6KhOJKQLJL277nHkiQnQBg/XXhxXKOHocsxjaPI9of68NfllLQqekj CC4lLHeIldeLSY3Zyjf3BIvrFu5eyrh3FUPRMDIpIMYJhcmp4qiHlO3a5D2E2IzDVkcI rKCM0kWLw3d2okdBTlDcoQ75KGpcXQoP+JXcgwzVd+qA6PbYLRoVIQtwXj331FW4aAtb fPpoyES3TpSgivlJkc3RF+dxbO3xJD8fd1NoVyjvV9W0Ffu0Dg+SkPAJVBI5+++C0s6x O9y2l5xaWiIqn8MX5iZqJYNIh3L2UWIUdvC1biFJzGbgfA/tmD727uiMfKodPgQjErI+ 4BNQ==
MIME-Version 1.0
X-Received by 10.224.39.77 with SMTP id f13mr18217147qae.96.1369436422294; Fri, 24 May 2013 16:00:22 -0700 (PDT)
In-Reply-To <CAEcwjcx6WtUMTg=QpqjEZ3fyfUhOLWQ2v-pF4qQ9ypFd3DtByA@mail.gmail.com>
References <CAEcwjcx6WtUMTg=QpqjEZ3fyfUhOLWQ2v-pF4qQ9ypFd3DtByA@mail.gmail.com>
Date Fri, 24 May 2013 16:00:22 -0700
Subject Re: Prepending string "@" to usernames
From Dan Stromberg <drsalists@gmail.com>
To Thomas Murphy <thomasmurphymusic@gmail.com>
Content-Type multipart/alternative; boundary=20cf3074d9267e711c04dd7ec3ae
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.2082.1369436425.3114.python-list@python.org> (permalink)
Lines 126
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369436425 news.xs4all.nl 15924 [2001:888:2000:d::a6]:43690
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45923

Show key headers only | View raw


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

On Fri, May 24, 2013 at 3:53 PM, Thomas Murphy
<thomasmurphymusic@gmail.com>wrote:

> Hi beloved list,
>
> I'm having a dumb and SO doesn't seem to have this one answered. I was
> sent a long list of instagram usernames to tag for a nightlife
> announcement in this format(not real names(i hope))
>
> cookielover93
> TheGermanHatesSaurkraut
> WhatsThatBoy932834
>
> I'd like to turn this raw text into a list and prepend the @ symbol to
> the front of each one, so they're good to go for pasting without me
> having to manually add the @ to each one.
>
> Here's where I got to:
>
>
> raw_address = "cookielover93 TheGermanHatesSaurkraut WhatsThatBoy932834"
> address_library = [raw_address.split()]
> print address_library
>
> for address in address_library:
>     final_address = "@" + str(address)
> print final_address
>
>
> However my output is:
>
> [['cookielover93', 'TheGermanHatesSaurkraut', 'WhatsThatBoy932834']]
> @['cookielover93', 'TheGermanHatesSaurkraut', 'WhatsThatBoy932834']
>
>
> I know I'm iterating wrong. May I ask how?
>
> --
> Sincerely,
> Thomas Murphy
> Code Ninja
> 646.957.6115
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Maybe this is what you're looking for?

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

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


Thread

Re: Prepending string "@" to usernames Dan Stromberg <drsalists@gmail.com> - 2013-05-24 16:00 -0700

csiph-web