Not x.islower() has different output than x.isupper() in list output...

Christopher Reimer christopher_reimer at icloud.com
Sat Apr 30 13:36:19 EDT 2016


On 4/30/2016 10:11 AM, Stephen Hansen wrote:
> You're thinking of the whole "string", but you're operating on 
> single-character substrings, and when " ".islower() is run, its false. 
> Because the two-pronged test, a) if all cased characters are lowercase 
> and b) there is at least one cased character. b) is failing. Ergo, 
> you're getting the underscores.

I see where the problem lies in my thinking. I went looking for a single 
line solution for the whole string. If I had constructed a for loop and 
tried to reduce it to a single line, I *may* have understood the 
relationship between the different parts. Or maybe not. Blaming the 
documentation is a lot easier. ;)

Thank you,

Chris R.



More information about the Python-list mailing list