About 2,350,000 results
Open links in new tab
  1. python - How to print like printf in Python3? - Stack Overflow

    Python integers are passed as the platforms default C int type, their value is masked to fit into the C type. This explains why I wrapped the Python float objects using ctypes.c_double (FYI, a Python float …

  2. python - What is print (f"...") - Stack Overflow

    Jul 22, 2019 · 63 In Python 3.6, the f-string, formatted string literal, was introduced (PEP 498). In short, it is a way to format your string that is more readable and fast. Example:

  3. python - How to print formatted string in Python3? - Stack Overflow

    Hey I have a question concerning this print ("So, you're %r old, %r tall and %r heavy.") % ( age, height, weight) The line doesn't work in python 3.4 do anyone know how to fix this?

  4. string - sprintf like functionality in Python - Stack Overflow

    Mar 15, 2011 · I would like to create a string buffer to do lots of processing, format and finally write the buffer in a text file using a C-style sprintf functionality in Python. Because of conditional statement...

  5. printing - Print variable and a string in python - Stack Overflow

    3 If the Python version you installed is 3.6.1, you can print strings and a variable through a single line of code. For example the first string is "I have", the second string is "US Dollars" and the variable …

  6. python - String formatting: % vs. .format vs. f-string literal - Stack ...

    158 Assuming you're using Python's logging module, you can pass the string formatting arguments as arguments to the .debug() method rather than doing the formatting yourself:

  7. printf - How to print a C format in python - Stack Overflow

    A python newbie question: I would like to print in python with the c format with a list of parameters:

  8. python - Display number with leading zeros - Stack Overflow

    How do I display a leading zero for all numbers with less than two digits? 1 → 01 10 → 10 100 → 100

  9. What is an easy way to implement fprintf in python?

    Oct 28, 2017 · In python, the following will let us write to stdout: import sys sys.stdout.write("blah %d" % 5) However, I want to be flexible about which stream we print to. I want to pass the stream as an argu...

  10. python - Directing print output to a .txt file - Stack Overflow

    130 Is there a way to save all of the print output to a txt file in python? Lets say I have the these two lines in my code and I want to save the print output to a file named output.txt.