进行bs通信;原理与之前的电脑自建client和server相似
标签:
一.web入门之html 1.html小试牛刀电脑做client,浏览器做server,进行bs通信;道理与之前的电脑自建client和server相似,server和client进行cs通信。
import socket def main(): sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) sock.bind((‘localhost‘,8080)) sock.listen(5) while True: connection,address = sock.accept() buf = connection.recv(1024) connection.sendall(bytes("HTTP/1.1 201 OK\r\n\r\n","utf8")) connection.sendall(bytes("<h1>hello world</h1>","utf8")) connection.close() if __name__ == "__main__": main()
差别标题的前端暗示
connection.sendall(bytes("<h1>hello world1</h1> <h2>hello world2</h2> <h3>hello world3</h3> <h4>hello world4</h4>","utf8"))
其次,如果给与.html写代码,并且用f.open()打开,并运行。打开test.html文件,内容如下
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <h1>hello world</h1> <h3>hello world</h3> <img src="html_image.PNG" alt=""> </body> </html>
用html.py文件加载
import socket def main(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind((‘localhost‘, 8087)) sock.listen(5) while True: connection, address = sock.accept() buf = connection.recv(1024) connection.sendall(bytes("HTTP/1.1 201 OK\r\n\r\n", "utf8")) f = open("test.html","rb") data = f.read() connection.sendall(data) connection.close() if __name__ == "__main__": main()
css构造用
js自动轮播/手动轮播/tab切换
jss悬浮,动画
2.构建html页面html界说:htyper text markup language 即超文本符号语言;
超文本:就是指页面内可以包罗图片、链接,甚至音乐、措施等非文字元素;
符号语言:符号(标签)组成的语言。
网页 == HTML文档,由浏览器解析,用来展示的
静态网页:静态的资源,如xxx.html
动态网页:html代码是由某种开发语言按照用户请求动态生成的
2.1html文档树形布局:
2.2标签界说
2.3标签属性
第4点解释:
<input type="text" readonly="readonly"> 上面行代码即是 <input type="text" readonly>
2.4<iDOCTYPEhtml>标签
web表达三剑客之html
温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/31167.html
- 上一篇:那么就促成JS的回调函数
- 下一篇:我第一次接触vue