打印当前文件和行号
there的Python项目详细描述
那里
打印当前文件名和行。
例如,where.py
importthereimportthereashereprint(here)print('and')print(there)
然后python where.py
将打印:
where.py:4
and
where.py:6
替换打印功能
There
为print
函数提供替换,该函数在
文件名和行
例如,where.py
fromthereimportprintprint('hi')print('there')
然后python where.py
将打印:
where.py:3 hi
where.py:4 there
就这样
就这样,不多,不少。我有计划-通常永远不会
实现了也有一个there.indent
,返回
当前行
哥特恰
返回计算__str__
或there
的__repr__
的行。
通常通过print
所以可能是错的如果你想确定(比如什么时候
使用log
)将其包装成str()
可能只在CPython上运行但无论如何不要在生产中运行它