nie*_*aki 1 python command-line-interface
当我在交互式shell中使用python时,我可以通过调用它们的名称轻松转储变量.
>>> x = b'\xA5' >>> x '\xa5' >>> print x ?
如您所见,行为与行为不同print.如何在普通脚本中模拟这个类似CLI的变量转储?
print
sam*_*ias 5
使用repr()内置函数:
repr()
>>> x = '\xa5' >>> print repr(x) '\xa5'
归档时间:
15 年,1 月 前
查看次数:
453 次
最近记录: