Hey, everyone. I know how to strip certain characters from a string using for loop. Can you give an example of how that can be done with the use of while loop?
pyprog
0
Light Poster
Recommended Answers
Jump to PostI am trying to figure out a situation which requires looping...
>>> string 'Take out all the 111111111111111111' >>> string.replace('1','').strip() 'Take out all the'
See what i mean?
If you just need a while example...
>>> x = 0 >>> while x < …
Jump to PostHey, everyone. I know how to strip certain characters from a string using for loop. Can you give an example of how that can be done with the use of while loop?
Please post your code with the for loop and we'll rewrite it with a while loop :)
All 6 Replies
lukerobi
4
Junior Poster in Training
Gribouillis
1,391
Programming Explorer
Team Colleague
pyprog
0
Light Poster
lukerobi
4
Junior Poster in Training
lukerobi
4
Junior Poster in Training
Gribouillis
1,391
Programming Explorer
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.