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


Groups > comp.lang.python > #45922

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!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <thomasmurphymusic@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.075
X-Spam-Evidence '*H*': 0.85; '*S*': 0.00; 'skip:[ 20': 0.04; 'output': 0.05; 'subject:string': 0.09; '"@"': 0.16; 'iterating': 0.16; 'usernames': 0.16; 'print': 0.22; "doesn't": 0.30; 'announcement': 0.30; 'skip:@ 10': 0.30; 'message- id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'front': 0.32; 'text': 0.33; 'raw': 0.33; "i'd": 0.34; 'one,': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'turn': 0.37; 'list': 0.37; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'list,': 0.38; 'to:addr:python.org': 0.39; 'manually': 0.60; 'tag': 0.61; 'address': 0.63; 'real': 0.63; 'thomas': 0.65; 'beloved': 0.84; 'pasting': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=TUviR4CNKZTFB+z8je1bmJ7nfZUpcWD5RpCrjy1IHZs=; b=RYyYZJuidzcpJFsSKipg4qkomY0ZmnTBwNtcvyWCxbQthFpaxvpaNf4CLA2o4VgwYD 2TrwTRhBLtpYWd78TYIDfxD7GLSSAm/gr9QhaeDPLs7F2UW/dOivjqI+s4Jf9c82qrjZ 9Vg1pIAlDKc+BIzhp3UBVw1FcOx2fw1wbPj0o8jgvwkwwYeb5ubAkOVG6Ztm9sqlEE/v 5eh1P4xcBoKEYD13EJINGwAbp/giTTDB+0qyvQVZ1rvQeST32d/1ba9lYXjCxUCHfxNK r9zebQ87ebIPII79/DANSM0HI0yya0K3S7IW/T8nGXKiWtacWgspta+KNj0RN1dSLEgO o5SA==
MIME-Version 1.0
X-Received by 10.50.117.42 with SMTP id kb10mr619219igb.78.1369436032359; Fri, 24 May 2013 15:53:52 -0700 (PDT)
Date Fri, 24 May 2013 18:53:52 -0400
Subject Prepending string "@" to usernames
From Thomas Murphy <thomasmurphymusic@gmail.com>
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
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.2081.1369436041.3114.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369436041 news.xs4all.nl 15975 [2001:888:2000:d::a6]:40876
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:45922

Show key headers only | View raw


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

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


Thread

Prepending string "@" to usernames Thomas Murphy <thomasmurphymusic@gmail.com> - 2013-05-24 18:53 -0400
  Re: Prepending string "@" to usernames Larry Hudson <orgnut@yahoo.com> - 2013-05-24 20:24 -0700

csiph-web