About 1,510,000 results
Open links in new tab
  1. python - Return the result instead of printing in a function

    Dec 23, 2013 · Here's a way to do it where you don't have to change your function's code at all. Instead, we'll create a function decorator that silently catches all printed output, and saves it for later use.

  2. No-Print Python. Stop using print to debug. | by Hamza - Medium

    Sep 5, 2021 · There’s the really handy icecream Python library that makes debugging easier without needing to put loads of print statements everywhere. We can use ic() instead of the plain old print() to...

  3. how to Print a function without printing the Return type in Python ...

    Jul 14, 2015 · Don't print the result of the function, just call the function. The following should do it. Notice that the function call is in its own line. The comma in your original code is causing the return value of abcd to be passed to print. print "Current Hand:" abcd(hand)

  4. Why should I use return instead of print in a : r/learnpython

    Apr 10, 2021 · return is used to pass some data from a function back to the place the function was called. print is used to be able to read things from your program in the terminal. It's just a fluke that, when you're starting out, you nearly always want those two things at the same time.

  5. What is the advantage of the new print function in Python 3.x …

    print is the only application-level functionality that has a statement dedicated to it. Within Python's world, syntax is generally used as a last resort, when something can't be done without help from the compiler. Print doesn't qualify for such an exception.

  6. PrintAsFunction - Python Wiki

    Mar 16, 2025 · Guido has made it clear he wants to get rid of the print statement in Python3.0. This page considers why we would want to go that way, and how we can actually get there. It should be turned into a PEP eventually.

  7. 7. Input and Output — Python 3.13.3 documentation

    3 days ago · So far we’ve encountered two ways of writing values: expression statements and the print() function. (A third way is using the write() method of file objects; the standard output file can be referenced as sys.stdout. See the Library Reference for more information on this.)

  8. What’s New In Python 3.0 — Python 3.13.3 documentation

    Time to retrain your fingers to type print(x) instead! When using the 2to3 source-to-source conversion tool, all print statements are automatically converted to print() function calls, so this is mostly a non-issue for larger projects. Some well-known APIs no longer return lists:

  9. Your Guide to the Python print() Function – Real Python

    There are a few ways to achieve this. First, you may pass a string literal directly to print (): >>> print('Please wait while the program is loading...') This will print the message verbatim onto the screen. Secondly, you could extract that message into its own variable with a meaningful name to enhance readability and promote code reuse:

  10. Why did python 3 change the 'print' syntax? : r/Python - Reddit

    Feb 15, 2016 · When print is a function, all this garbage goes away and you use standard function calling syntax that works like the rest of the language: print('foo', file=sys.stderr) print(a, b, c, end='') You can't use argument splatting with a statement.

  11. Some results have been removed
Refresh