"Emile van Sebille" <em...@fenx.com> wrote
a = [item.upper() if type(item) == str else item for item in mylist]

should do it I think.

or even

  a = [ str(item).upper() for item in mylist ]

That was my first attempt but the OP wanted his integers preserved as integers whereas this would convert them to strings.

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to