Skip to content

Instantly share code, notes, and snippets.

@AnurajBhaskar47
Created July 4, 2024 07:28
Show Gist options
  • Select an option

  • Save AnurajBhaskar47/c6127ffa27dc88aca41377678bd66d6c to your computer and use it in GitHub Desktop.

Select an option

Save AnurajBhaskar47/c6127ffa27dc88aca41377678bd66d6c to your computer and use it in GitHub Desktop.
python debug statement for a loop
import os
import sys
if not os.path.exists('debug.log'):
with open('debug.log', 'w') as sys.stdout:
print('**** print debug')
else:
with open('debug.log', 'a') as sys.stdout:
print('**** pring debug')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment