Python Forum
str.replace affects the if statement!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
str.replace affects the if statement!
#2
In the second code, str.replace() replaces all instances of "NOUN" on the first iteration of the loop with the selected noun from the if statement. Conversely, the first code inserts the word at the index points, allowing for different nouns to be selected. Is that the performance difference you're inquiring about?
Reply


Messages In This Thread
str.replace affects the if statement! - by Eslam - Mar-29-2020, 10:01 PM
RE: str.replace affects the if statement! - by stullis - Mar-29-2020, 11:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Search & Replace - Newlines Added After Replace dj99 3 3,443 Jul-22-2018, 01:42 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020