摘要:
server client 阅读全文
posted @ 2019-01-24 23:47
anobscureretreat
阅读(158)
评论(0)
推荐(0)
摘要:
输出 阅读全文
posted @ 2019-01-24 21:51
anobscureretreat
阅读(179)
评论(0)
推荐(0)
摘要:
import time import threading def task_thread(counter): print(f'线程名称:{threading.current_thread().name} 参数:{counter} 开始时间:{time.strftime("%Y-%m-%d %H:%M:%S")}') num = counter while num: ... 阅读全文
posted @ 2019-01-24 21:08
anobscureretreat
阅读(175)
评论(0)
推荐(0)
摘要:
输出 阅读全文
posted @ 2019-01-24 18:09
anobscureretreat
阅读(269)
评论(0)
推荐(0)
摘要:
协程的概念 协程,又称微线程,纤程。英文名Coroutine。一句话说明什么是线程:协程是一种用户态的轻量级线程。(其实并没有说明白~) 我觉得单说协程,比较抽象,如果对线程有一定了解的话,应该就比较好理解了。 那么这么来理解协程比较容易: 线程是系统级别的,它们是由操作系统调度;协程是程序级别的, 阅读全文
posted @ 2019-01-24 17:14
anobscureretreat
阅读(255)
评论(0)
推荐(0)
摘要:
server 输出: client 输出: 阅读全文
posted @ 2019-01-24 16:15
anobscureretreat
阅读(260)
评论(0)
推荐(0)
摘要:
def str_to_hex(s): return ' '.join([hex(ord(c)).replace('0x', '') for c in s]) def hex_to_str(s): return ''.join([chr(i) for i in [int(b, 16) for b in s.split(' ')]]) def str_to_bin(s... 阅读全文
posted @ 2019-01-24 16:11
anobscureretreat
阅读(849)
评论(0)
推荐(0)
摘要:
>>> x='123abc' >>> b=bin(int(x,16))[2:] >>> print(b) 100100011101010111100 阅读全文
posted @ 2019-01-24 16:09
anobscureretreat
阅读(16964)
评论(0)
推荐(3)
摘要:
name = 'laogaoyang' # 采用系统默认编码格式 nameBytes = name.encode('utf-8') # 先将 name 解码(采用系统默认格式),然后用 'utf-8' 编码,最后格式为字节 nameStr = nameBytes.decode('utf-8') #将字节转为字符串 阅读全文
posted @ 2019-01-24 16:06
anobscureretreat
阅读(523)
评论(0)
推荐(0)
摘要:
1. 字节数组 --> 十六进制字符串 >>> a = 'ab' >>> a.encode('hex') '6162' 2. 十六进制字符串 --> 字节数组 >>> b = '6162' >>> b.decode('hex') 'ab' 注意:十六进制字符串中只能包含0-9, a-f, A-F, 否则decode('hex')会执行失败 阅读全文
posted @ 2019-01-24 16:03
anobscureretreat
阅读(6557)
评论(0)
推荐(0)
摘要:
第一种 第二种 第三种 阅读全文
posted @ 2019-01-24 15:51
anobscureretreat
阅读(965)
评论(0)
推荐(0)
摘要:
数值为:0xFD 阅读全文
posted @ 2019-01-24 15:48
anobscureretreat
阅读(4854)
评论(0)
推荐(0)
摘要:
server 输出: client 输出 阅读全文
posted @ 2019-01-24 13:26
anobscureretreat
阅读(202)
评论(0)
推荐(0)

浙公网安备 33010602011771号