Skip to content
murmot

Results for “python join string method with loop code java site:discuss.python.org pdf”

  • discuss.python.org

    String concatenation with a for loop - Python Help ...

    Nov 26, 2024 · My guess is that its the cost of access to local variables, part 1, compared to the cost of access to global variables in part 2. In both cases the string manipulation of t += c is the same. Note that each time you call t += c python actually does t = t + c that creates a new string to replace t every time around the loop.

  • discuss.python.org

    Combine JOIN (), {ORD (CHAR)} & ZFILL () in one op - Python ...

    Dec 4, 2024 · Greetings. New to forum here. Not entirely new to Python scripting, but my usage has mostly been limited to automating regex replacements via the PythonScript plugin in Notepad++. Now I’m attempting to cobble together a short script that takes a string of characters and converts it to a string of concatenated, 0-padded decimal codepoint values. For example, if input is ...

  • discuss.python.org

    Allow str.join to take *args in addition to iterable (like ...

    Jan 23, 2020 · I’m using black for formatting, so I can’t omit indentation. I want to construct them at run time because I’m lazy . Compile-time literal string concatenation was my original approach. The impetus for using str.join was to avoid having to add \n (or forgetting to…). Triple quoted strings are either an eyesore: def f(): """line1 line2 line3""" or have to be dedented with textwrap.dedent ...

  • discuss.python.org

    Discussions on Python.org

    Discussions related to the Python Programming Language, Python Community, and Python Software Foundation operations.

  • discuss.python.org

    Quick question on .join () - Python Help - Discussions on ...

    Mar 31, 2022 · The '' makes an empty string. .join () calls a method on the string. A method is somewhat like a function, but attached to a specific object. The join () method of string objects concatenates strings with the string whose method is being called as the separator. That should give you most search terms to learn more.

  • discuss.python.org

    Sliding window question -- how to optimize the loop usage - Python...

    This is a standard question of finding the longest substring without repeating characters. My code does work, but I have two while loops of which I am not sure any one can be further simplified: class Solution: def lengthOfLongestSubstring(self, s: str) -> int

  • discuss.python.org

    String joining design - Core Development - Discussions on ...

    Jan 2, 2023 · 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 built-in or a string function. String function won of course, and it does make sense, but I think it was @tim.one who suggested and preferred calling it on a variable instead of ...