On 05/24/2013 03:53 PM, Thomas Murphy wrote:
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_addr
> Which can be tidily written as a list comprehension:
>
> final_address = ['@' + address for address in raw_address.split()]
>
> -tkc
>
>
Ah! Thanks Tim…that tidiness is something I'm trying to head towards
in my own code. I'm trying to transition from the need to visually
write every little ste
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))
>> prin
On 25/05/2013 00:04, Thomas Murphy wrote:
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("@"
On 2013.05.24 17:53, Thomas Murphy wrote:
> I know I'm iterating wrong. May I ask how?
.split() already returns a list, so instead of iterating over the list and
getting a single username, you iterate over the list and get a
single list.
--
CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1
--
ht
> 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
On Fri, May 24, 2013 at 3:53 PM, Thomas Murphy
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
> TheGermanHa