打印当前文件和行号
项目描述
There
打印当前文件名和行。
例如,where.py
import there
import there as here
print(here)
print('and')
print(there)
然后 python where.py
将打印
where.py:4
and
where.py:6
替换print函数
There
提供了替换 print
函数的解决方案,该函数会在前面添加文件名和行号。
例如,where.py
from there import print
print('hi')
print('there')
然后 python where.py
将打印
where.py:3 hi
where.py:4 there
就是这样
就是这样(目前),不多也不少。我有计划(通常永远不会实现)—— 要有一个 there.indent
,它可以返回当前行的缩进。
注意事项
返回计算 __str__
或 __repr__
的 there
的行。通常通过 print
。所以它可能不正确。如果您想要确保(例如,使用 log
),请将其包裹在 str()
中。
可能仅在CPython上运行。但无论如何,不要在生产环境中运行。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解有关 安装软件包 的更多信息。
源分布
there-0.0.12.tar.gz (43.1 kB 查看哈希)
构建分布
there-0.0.12-py2.py3-none-any.whl (3.2 kB 查看哈希值)
关闭
there-0.0.12.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 8e4bff9ba3cdb63bce1ad49c203680542ef175e64887bd895ae5ae538243f31c |
|
MD5 | be500a4f7086c5a9e28f4a769d921c68 |
|
BLAKE2b-256 | b2d2a47f6f7fce7a5db9a3517c8f839d9a9b002405c8901e9e0b3890f90e1254 |
关闭
there-0.0.12-py2.py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | de8d6eaf343f48635640b7d092c13a265b955e52f85d423f410cb57bd8436afe |
|
MD5 | e14443174ebd71d5893327824d3f1e70 |
|
BLAKE2b-256 | d431c2aa184c8579c478e12b4b4bbfef50a209a0d03c55b23040a2820db6eeff |