【发布时间】:2011-08-18 22:01:06
【问题描述】:
在解释器中,您可以只写一个对象的名称,例如解释器提示处的列表a = [1, 2, 3, u"hellö"],如下所示:
>>> a
[1, 2, 3, u'hell\xf6']
或者你可以这样做:
>>> print a
[1, 2, 3, u'hell\xf6']
这似乎与列表等效。目前我正在使用 hdf5 管理一些数据,我意识到上述两种方法之间存在差异。给定:
with tables.openFile("tutorial.h5", mode = "w", title = "Some Title") as h5file:
group = h5file.createGroup("/", 'node', 'Node information')
tables.table = h5file.createTable(group, 'readout', Node, "Readout example")
输出
print h5file
不同于
>>> h5file
所以我想知道是否有人可以解释 Python 在这两种情况下的行为差异?
【问题讨论】: