On 03/10/11 01:33, Christopher King wrote:
Dear Tutors,
     I was wondering how one would make it so all the cases of all the
strings in a python file where switched. I know that
for individual strings, you can use .swapcase(),

So just apply swapcase() to the whole file as a string:

s = open("spam.py").read().swapcase()

> but I'm making a program to edit others,

I don't know what that means? "edit others" what?

so it would be easier to just do something at
the top that would switch all other strings.

Other strings as opposed to what?
Do you want to swap case of all characters in the file?
Or only some of them? And if only some how do you distinguish
which ones?

HTH,

--
Alan G
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