Python Forum
is there any way to hid print()
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
is there any way to hid print()
#2
Logging is really the right way to do this.

import logging

logging.basicConfig(level=logging.DEBUG)
variable = 34
## instead of a debug print(), just use logging.debug.
logging.debug(f"Now the variable is {variable}")
When run this way, you'll get output during the running with the DEBUG output. Change the config line to a higher level (like level=logging.WARNING) and the debug messages go away.

With DEBUG
Output:
$ python3 logit.py DEBUG:root:Now the variable is 34 34
With the level set to WARNING

Output:
$ python3 logit.py 34
Reply


Messages In This Thread
is there any way to hid print() - by Kai - Apr-12-2020, 03:20 AM
RE: is there any way to hid print() - by bowlofred - Apr-12-2020, 06:23 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020