0

As you might know, there is the #line command in the C-preprocessor:

#include <stdio.h>
#line 20 "abc"
int main() {
    printf("%i %s\n", __LINE__, __FILE__); //outputs 22 abc
}

Is there something like this #line command in python? I want to change what is printed in exceptions.

Note: This is not the same question as in How to determine file, function and line number?, becaues they want to print the current line, I want to change it.

Volker Weißmann
  • 544
  • 1
  • 5
  • 22

0 Answers0