[Tutor] Printing two elements in a list
Kent Johnson
kent37 at tds.net
Mon Dec 20 14:04:32 CET 2004
Max Noel wrote:
>
> On Dec 19, 2004, at 06:16, Jacob S. wrote:
>
>> Would this work for you?
>>
>> a = ['Name = stuff','CGTATAGCTAGCTA','Name = stuff','CGATATGCCGGCTA']
>> for index,thing in enumerate(a):
>> if "Name=" in thing:
>> del a[index]
>>
>
> A faster way to do this would be to use something like:
>
> if thing.beginswith("Name"): del a[index]
Like, maybe,
if thing.startswith('Name')...
;)
Kent
More information about the Tutor
mailing list