What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-03 15:25:06
python traceback single line logging module
import logging class OneLineExceptionFormatter(logging.Formatter): def formatException(self, exc_info): """ Format an exception so that it prints on a single line. """ result = super().for... Add solution -
Python 2022-02-04 18:30:17
python replace string in file
# Read in the file with open('file.txt', 'r') as file : filedata = file.read() # Replace the target string filedata = filedata.replace('ram', 'abcd') # Write the file out again with open('file.txt', 'w') as file: file.write(filedata) Add solution -
Python 2022-02-01 00:15:06
python find and replace string in file
# Read in the file with open('file.txt', 'r') as file : filedata = file.read() # Replace the target string filedata = filedata.replace('ram', 'abcd') # Write the file out again with open('file.txt', 'w') as file: file.write(filedata) Add solution
Best helpers
Ranking is empty