我在python的套接字中遇到了一些問題。 我想寫一個關於sync_file的類,這些就是我寫的。python socket參數
import socket
class sync:
def send_file(path,Socket): #I would like to income two argument. First one is the file's path, and the second one is the socket object.
f = open(path,"rb");
line = f.read()
f.close()
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
a = sync()
a.sendfile(file,s)
我想我可以把插座對象作爲參數,但它顯示了一個錯誤message.It說,爭論的預期數量爲兩個,但我送三。 我不知道爲什麼會發生。
感謝您的回答 – Oberon