資源簡介
Python程序設計-董付國(第二版)書中源代碼及課件
代碼片段和文件信息
import?socket
import?sys
#服務端主機IP地址和端口號
HOST?=?‘10.2.1.2‘
PORT?=?50007
s?=?socket.socket(socket.AF_INET?socket.SOCK_STREAM)
try:
????#連接服務器
????s.connect((HOST?PORT))
except?Exception?as?e:
????print(‘Server?not?found?or?not?open‘)
????sys.exit()
while?True:
????c?=?input(‘Input?the?content?you?want?to?send:‘)
????#發送數據
????s.sendall(c.encode())
????#從服務端接收數據
????data?=?s.recv(1024)
????data?=?data.decode()
????print(‘Received:‘?data)
????if?c.lower()?==?‘bye‘:
????????break
#關閉連接
s.close()
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????589??2016-11-25?08:23??源代碼\第10章?網絡程序設計\code\chatClient.py
?????文件???????1337??2016-11-25?08:41??源代碼\第10章?網絡程序設計\code\chatServer.py
?????文件????????534??2015-12-24?09:31??源代碼\第10章?網絡程序設計\code\client.py
?????文件????????296??2016-12-31?10:09??源代碼\第10章?網絡程序設計\code\crawYichangGuishi\crawYichangGuishi\items.py
?????文件????????297??2016-12-31?10:09??源代碼\第10章?網絡程序設計\code\crawYichangGuishi\crawYichangGuishi\pipelines.py
?????文件???????3216??2016-12-31?10:09??源代碼\第10章?網絡程序設計\code\crawYichangGuishi\crawYichangGuishi\settings.py
?????文件???????1409??2016-12-31?16:55??源代碼\第10章?網絡程序設計\code\crawYichangGuishi\crawYichangGuishi\spiders\spiderYichangGuishi.py
?????文件????????161??2016-04-28?15:02??源代碼\第10章?網絡程序設計\code\crawYichangGuishi\crawYichangGuishi\spiders\__init__.py
?????文件???????1438??2016-12-31?16:56??源代碼\第10章?網絡程序設計\code\crawYichangGuishi\crawYichangGuishi\spiders\__pycache__\spiderYichangGuishi.cpython-35.pyc
?????文件????????160??2016-12-31?10:50??源代碼\第10章?網絡程序設計\code\crawYichangGuishi\crawYichangGuishi\spiders\__pycache__\__init__.cpython-35.pyc
?????文件??????????0??2016-04-28?15:02??源代碼\第10章?網絡程序設計\code\crawYichangGuishi\crawYichangGuishi\__init__.py
?????文件????????289??2016-12-31?10:50??源代碼\第10章?網絡程序設計\code\crawYichangGuishi\crawYichangGuishi\__pycache__\settings.cpython-35.pyc
?????文件????????152??2016-12-31?10:50??源代碼\第10章?網絡程序設計\code\crawYichangGuishi\crawYichangGuishi\__pycache__\__init__.cpython-35.pyc
?????文件????3826564??2016-12-31?16:59??源代碼\第10章?網絡程序設計\code\crawYichangGuishi\result.txt
?????文件????????278??2016-12-31?10:09??源代碼\第10章?網絡程序設計\code\crawYichangGuishi\scrapy.cfg
?????文件???????3072??2016-05-07?19:56??源代碼\第10章?網絡程序設計\code\django_IsPrime\db.sqlite3
?????文件???????2662??2016-05-07?19:46??源代碼\第10章?網絡程序設計\code\django_IsPrime\django_IsPrime\settings.py
?????文件????????843??2016-05-07?20:05??源代碼\第10章?網絡程序設計\code\django_IsPrime\django_IsPrime\urls.py
?????文件????????498??2016-05-07?20:16??源代碼\第10章?網絡程序設計\code\django_IsPrime\django_IsPrime\view.py
?????文件????????405??2016-05-07?19:46??源代碼\第10章?網絡程序設計\code\django_IsPrime\django_IsPrime\wsgi.py
?????文件??????????0??2016-05-07?19:46??源代碼\第10章?網絡程序設計\code\django_IsPrime\django_IsPrime\__init__.py
?????文件???????2138??2016-05-07?19:56??源代碼\第10章?網絡程序設計\code\django_IsPrime\django_IsPrime\__pycache__\settings.cpython-35.pyc
?????文件???????1047??2016-05-07?20:05??源代碼\第10章?網絡程序設計\code\django_IsPrime\django_IsPrime\__pycache__\urls.cpython-35.pyc
?????文件????????640??2016-05-07?20:16??源代碼\第10章?網絡程序設計\code\django_IsPrime\django_IsPrime\__pycache__\view.cpython-35.pyc
?????文件????????579??2016-05-07?19:56??源代碼\第10章?網絡程序設計\code\django_IsPrime\django_IsPrime\__pycache__\wsgi.cpython-35.pyc
?????文件????????144??2016-05-07?19:56??源代碼\第10章?網絡程序設計\code\django_IsPrime\django_IsPrime\__pycache__\__init__.cpython-35.pyc
?????文件????????257??2016-05-07?19:46??源代碼\第10章?網絡程序設計\code\django_IsPrime\manage.py
?????文件???????3072??2016-05-08?10:03??源代碼\第10章?網絡程序設計\code\django_template\db.sqlite3
?????文件???????2665??2016-05-08?10:18??源代碼\第10章?網絡程序設計\code\django_template\django_template\settings.py
?????文件????????842??2016-05-08?10:06??源代碼\第10章?網絡程序設計\code\django_template\django_template\urls.py
............此處省略363個文件信息
評論
共有 條評論