[Tutor] Another string-manipulation question
agilfoy at frontiernet.net
Wed May 9 22:41:43 CEST 2007
Given a string, how would I?:
1. Make sure only the first letter string_name, is capitalized.
This would involve using string_name.lower() to lowercase everything
else, but how do I use .upper(), or some other method, to capitalize
only the first character?
2. Make sure that there are no symbols (non-letter, non-number) in the
string, and, if one is found, remove it.
Pseudocode time, as to a potential approach-
for each character in the string:
if character not in
"Computers were the first God-Satan collaboration project."
"Blind faith in bad leadership is not patriotism."
"One of the most horrible features of war is that all the war-propaganda, all
the screaming and lies and hatred, comes invariably from people who are not
fighting."-George Orwell, _Homage to Catalonia
More information about the Tutor