1.格式

message = "GET / HTTP/1.1\r\n\r\n"
s.sendall(message)
TypeError: 'str' does not support the buffer interface 修正为
s.sendall(bytes(message,"utf8"))

2.语法

SyntaxError:invalid syntax .
“语法错误:不正确的语法”。

3.str

TypeError: encoding or errors without a string argument

格式不对
:

4.套接字的成员函数send

套接字的成员函数send
socket.send(bytes[, flags]) 形参为字节类型
socket.recv(bufsize[, flags]) Receive datafrom the socket. The return value is abytes object representing the data received.

5,。

xxx.decode()  是把xxx按括号中的编码方式  解码成unicode
xxx.encode() 是把unicode类型的xxx按括号中的编码方式 进行编码(所以如果xxx不是unicode,系统会采用默认编解码方式对xxx进行解码,然后再做如上的编码操作)

6. urllib 获取中文

#!/usr/bin/env python
# encoding: utf-8
"""
@author: 侠之大者kamil
@file: hello.py
@time: 2016/4/13 10:18
"""
from urllib.request import urlopen
http = urlopen("http://www.cnblogs.com/kamil/")
print(http.read().decode('UTF-8'))

7.urllib发生url有中文

import urllib
s=‘中文’
s=urllib.parse.quote(s)
url='some english url character %s'%(s)
urllib.request.urlopen(url)

python3 报错集合的更多相关文章

  1. Python3 报错'latin-1' codec can't encode character 解决方案

    Python3 报错'latin-1' codec can't encode character 解决方案 在更新数据库操作时,报错: UnicodeEncodeError: 'latin-1' co ...

  2. Python3报错:ModuleNotFoundError: No module named '_bz2'

    系统信息 系统:CentOS Linux release 7.6.1810 (Core) python版本:python3.7   报错信息 from _bz2 import BZ2Compresso ...

  3. spring 整合Mybatis 《报错集合,总结更新》

    错误:java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldExcepti ...

  4. cocos2dx-lua控制台报错集合

    1.invalid 'cobj' in function 'lua_cocos2dx_Node_getLocalZOrder' 这个报错是lua的变量还在,但是他底层对应的C++对象已被销毁.

  5. springcloud报错集合

    springcloud启动报错Connection refused: connect 参考:https://blog.csdn.net/deemo__/article/details/78932401 ...

  6. python3 报错:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 201: invalid continuation byte

    代码: # -*- coding:utf-8 -*- from urllib import request resp = request.urlopen('http://www.xxx.com') p ...

  7. python3报错

    这个错误是我在从Excel中导入数据,,x,y 和z(z代表了强度)  然后通过xyz画出一个二维的灰度图片所出现的错误 原因是因为用mcml生成的数据如: TypeError: cannot per ...

  8. mysql 安装报错集合

    mysql-5.6.39 源码编译安装报错 报错信息: /tmp/ccV858jD.s: Assembler messages: /tmp/ccV858jD.s: Fatal error: can't ...

  9. Python 报错集合

    1.django_error:HINT: Add or change a related_name argument to the definition for...报错, 详情见: https:// ...

随机推荐

  1. wget 怎么下载https的连接错误: Unable to establish SSL connection

    curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.11.tgz?_ga=1.33040702.1440244624.1 ...

  2. MySQL迁移[转]

    http://dbarobin.com/2015/09/15/migration-of-mysql-on-different-scenes/ MySQL 迁移方案概览 MySQL 迁移无非是围绕着数据 ...

  3. 两步验证Authy时间同步问题

    Authy是我常用的软件之一,通常用于Google的两步验证,或者是其他基于Google两步验证的原理的衍生程序.比如Namesilo.印象笔记等均有使用. 先说说什么是两步验证. 两步验证 两步验证 ...

  4. Apache POI 实现对 Excel 文件读写

    1. Apache POI 简介 Apache POI是Apache软件基金会的开放源码函式库. 提供API给Java应用程序对Microsoft Office格式档案读和写的功能. 老外起名字总是很 ...

  5. CSS实现透明边框

    border: 8px solid rgba(255,255,255,0.2);

  6. 基于nodejs的终端天气查询

    国际惯例,先上效果图 前天,突然想到,怎么直接在命令行查询天气呢?好的,那就写一个吧.然后就开始找城市.天气的api接口,最终做出来这么一个东西. 安装方法:$ npm install tianqi ...

  7. winform程序自动升级

    可参考下面这个链接,描述挺详细的,下次用的时候试试,感谢牛逼的作者. http://www.fishlee.net/soft/simple_autoupdater/

  8. 详解C语言的htons和htonl函数、大尾端、小尾端

    在Linux和Windows网络编程时需要用到htons和htonl函数,用来将主机字节顺序转换为网络字节顺序. 在Intel机器下,执行以下程序 int main(){   printf(" ...

  9. [转]MyBatis传入多个参数的问题 - mingyue1818

    原文  http://www.cnblogs.com/mingyue1818/p/3714162.html 一.单个参数: public List<XXBean> getXXBeanLis ...

  10. 拼图游戏(js,C#,java三种语言)

    <html> <head> <meta charset="utf-8"> <style type="text/css" ...