Day1-python基础知识

一:python介绍

 1.Python 创始人是龟叔

 1 #Author:Han Wenlin
 2 #-*-coding:utf-8-*-
 3 import socket
 4 client = socket.socket()
 5 client.connect(("localhost",6969))
 6 f1 = open("file1.txt","wb")
 7 while True:
 8     msg = input(">>:").strip()
 9     if len(msg) ==0:continue                ##发不了空
10     client.send(msg.encode("utf-8"))
11     data = client.recv(10240)
12    # print("recv:",data.decode())
13  #   f1 = open("file1.txt","w",encoding="utf-8")
14     print(data)
15  #   f1.write(data.decode())
16     f1.write(data)
17     f1.close()
18 client.close()
View Code

 yM

posted @ 2018-03-06 14:29  韩文林  阅读(138)  评论(0)    收藏  举报