Why does .rstrip() work for list comprehensions but not for for loops?
I know it's a string method, but what's the difference?
Why would I have to show code for this question??? Like what?
When did I say "I WISH" it to? I'm asking about the how the language works.
All of that TV has melted your brain.
I was not talking to husoski Brilliant_movies, the commenter I was replying to was removed because he broke Yahoo's rules and was being a douche.
- husoskiLv 71 month agoFavorite Answer
So far, the correct answer seems to be, "Who *said* that .rstrip() doesn't work with for loops?"
for c in 'abc \n'.rstrip():
So, you seem to be doing something else that doesn't work; and then blaming that on .rstrip(). *That's* why you need to show code...so someone who feels helpful might show you what your misconception is.
- brilliant_movesLv 71 month ago
You wrote: Why does .rstrip() work for list comprehensions but not for for loops?" Well, it does work for for loops, as @Husoski has kindly showed you, giving an example to back it up. I think he deserves more respect for sharing his wisdom here, for free.