简单python阅读线程

2024-04-19 19:47:50 发布

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

我想问一个简单的问题:在python中使用线程,但只在使用TCP发送时使用 所以我的密码

class myThread(threading.Thread):
    def __init__ (self):
        threading.Thread.__init__(self)

    def run(self):
        #time.sleep(30)
        print "File will be sent now"
            from ftplib import FTP
            ftp = FTP('192.168.1.3')
            ftp.login('user', 'user')
            file = open('Number', 'rb')
            ftp.storbinary('STOR newNumber.txt', file)

我不明白如何使简单的阅读线程,而真正的线程.read()所以当它接收到一些东西时,它会把它放在一个字符串中,我发现了很多东西,但是我仍然不了解python编码它的方式

我想应该是三行,但是我没有得到(read,readable,readline,…)那些python方法。你知道吗

我的问题是,熟悉python的人能告诉我如何写这些行吗? 我找了很多,但事情对我来说有点复杂 the link I tried to understand for so long

提前谢谢


Tags: self密码readinitdefftp线程thread