- 博客(3)
- 收藏
- 关注
原创 TypeError: 'int' object is not iterable
for i in len(nums): n=len(nums) for m in n: if nums[i]+nums[m]==target : return [i,m]Python写循环程序的时候遇到 TypeError: ‘int’ object is not iterable,原因是循环中使用的应该是一组数class Solution...
2020-02-28 12:26:28
5421
原创 Python报“TypeError:abytes-likeobjectisrequired,not‘str’”解决办法
只需要用上python的bytes和str两种类型转换的函数encode()、decode()即可! str通过encode()方法可以编码为指定的bytes; 反过来,如果我们从网络或磁盘上读取了字节流,那么读到的数据就是bytes。要把bytes变为str,就需要用decode()方法; data = tcpclient.recv(1024) print( data.decode(...
2020-02-27 15:04:59
473
原创 Python最简单的socket服务端和客户端收发
客户端:from socket import *tcpclient = socket(AF_INET, SOCK_STREAM)add = (‘localhost’, 8889)tcpclient.connect(add)while True:mes = input(“输入:”)tcpclient.send(mes.encode())data = tcpclient.recv(1...
2020-02-27 12:55:38
356
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人