Skip to content
murmot

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

  • discuss.python.org

    `str.join (str (i) for i in value)` for `f-strings`

    Jan 26, 2023 · I’ll concede that ", ".join (str (i) for i in value) isn’t an obvious idiom, but once you’ve learned the components (string methods, the idiomatic way join works, generator expressions) it’s far more explicit and flexible than a dedicated function would be. And it’s short enough that you can wrap it in a local function if you want.

  • 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

    Discussions on Python.org

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

  • discuss.python.org

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

    Jan 23, 2020 · I don’t think that’s the case; this shortcut is part of the main interpreter loop, and is only used for certain addition operations (+= or + between strings where, as you noted, the left operand is about to be tossed) in the Python layer.

  • 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 ...

  • discuss.python.org

    Can someone please help a beginner with a loop? - Python Help...

    We have a task to use a “for” loop to count spaces (" ") in a given string. I wrote a code that returns the right answer for one space, but failed to detect two spaces or no spaces (in that case i get an error message: UnboundLocalError: local variable ‘new_cnt’ referenced before assignment).

  • discuss.python.org

    String joining design - Page 3 - Core Development ...

    Jan 6, 2023 · To me, joining an arbitrary iterable of strings using a string separator is obviously a fundamental method of strings. Joining an array of arbitrary values using a string separator is, equally obviously, a fundamental method of arrays.