Python2.7从tempfi读取

2024-05-15 10:41:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用python2.7,我有一个关于读取tempfile的问题。这是我的密码:

import tempfile


for i in range(0,10):
    f = tempfile.NamedTemporaryFile()

    f.write("Hello")

    ##f.seek(0)

    print f.read()

有了这个代码,我得到了这样的结果:

Rワ
nize.pyR
゙`Sc
d
Rワ
Rワ
Z
Z
nize.pyR
゙`Sc

这些是什么?你知道吗

谢谢!你知道吗


Tags: inimport密码helloforreadrangeseek