About 22,000,000 results
Open links in new tab
  1. What's the difference between %s and %d in string formatting?

    81 from python 3 doc %d is for decimal integer %s is for generic string or object and in case of object, it will be converted to string Consider the following code

  2. What's the difference between %r, %s and %d in python?

    Mar 2, 2013 · This is explained in the Python documentation. In short, %d will format a number for display. %s will insert the presentation string representation of the object (i.e. str(o)) %r will insert the …

  3. Python- %s %f %d % etc - Stack Overflow

    Jan 28, 2019 · Just a heads up, don't use this notation. .format() and f-strings are preferred in Python 3.

  4. python - What does {:d} do? - Stack Overflow

    To get the output of whatever string I put in there, as {} is simply the placeholder for the variable. However, on a website I saw {:d} being used, and despite experimenting in Python to figure out what …

  5. What is the difference between %i and %d in Python?

    Dec 13, 2016 · 22 Python copied the C formatting instructions. For output, %i and %d are the exact same thing, both in Python and in C. The difference lies in what these do when you use them to …

  6. python - Does "\d" in regex mean a digit? - Stack Overflow

    In Python-style regex, \d matches any individual digit. If you're seeing something that doesn't seem to do that, please provide the full regex you're using, as opposed to just describing that one particular symbol.

  7. %d within print statement python - Stack Overflow

    Jul 3, 2015 · I encountered this in a function of a program and I don't understand how the %d can work inside a closed quote print statement. print "%d squared is %d." % (n, squared) The output when the …

  8. Python 2.7: %d, %s, and float() - Stack Overflow

    I am attempting to teach myself a little coding through the "learn python the hard way" book and am struggling with %d / %s / %r when tying to display a floating point number. How do you properly ...

  9. Python 3.12 SyntaxWarning: invalid escape sequence on triple-quoted ...

    Nov 22, 2023 · After updating to Python 3.12, I get warnings about invalid escape sequence on some triple-quotes comments. Is this a new restriction? I have the habit of documenting code using triple …

  10. python - How to change format of data to '%Y%m%d' in Pandas?

    Jul 12, 2018 · I have a DF with first column showing as e.g. 2018-01-31 00:00:00. I want to convert whole column (or during printing / saving to other variable) that date to 20180131 format. NOT …