newbie.string.listless

FMH shayman at uniserve.com
Fri Aug 31 22:53:04 EDT 2001


Hi
Trying to  to process a  list and use a string function on each item in the
list, then return a new list with the Capitalized items.  The output is
correct but how do you capture it to a  new list.  I realize you can't use a
string function on a list but by making a list copy and iterating over the
items shouldn't this work.

Thanks


names = ["one,"who","two","three"]

for i in names[:]:
 if i in names[:]:
  i = string.capitalize(i)
  print i,


One Who Two Three
>>> i
'Three'





More information about the Python-list mailing list