String joining design - Page 3 - Python Discussions
Jan 2, 2023 ... You're joining strings with strings, using a string separator. Why are you surprised its a string method? It certainly shouldn't be just a list ...
Jan 2, 2023 ... You're joining strings with strings, using a string separator. Why are you surprised its a string method? It certainly shouldn't be just a list ...
Dec 31, 2021 ... operators for performing arithmetic computations and string concatenation ... first Python command (or function, operator, statement ...
OT: Irrespective of f-strings, I really dislike the style of calling .join() on a string literal. I remember ages ago when we were debating how to add a string join function, there were arguments to making it either a …
What you want is to call the .write() method with the string you want to write, i.e. f2.write(your_output_string_here). Furthermore, @soil was also correct in inferring that you need to pass a string to the .write() method, not a list of strings.
Discussions on Python.org. String concatenation with a for loop.The later function creates a new bigger string reducing drastically the performance of the string appending loop in the provided code. This appears to be related to the issue #89799 .
Both of your methods take essentially the same time, since the nested loop doesn’t come into effect, while the simpler method above is nearly three times faster. On a very long string with many repeating segments, on the other hand