PHizing's recent timeline updates
PHizing

PHizing

V2EX member #231383, joined on 2017-05-19 09:50:30 +08:00
PHizing's recent replies
@91mikechaos 怎么改的?那个网页进去没有可选的。
Nov 29, 2017
Replied to a topic by PHizing Python 怎么把 bytearray 转换为二进制数据?
@Kisesy 你的方法可以,我试了,再转成 bytes 在 redis 上就看到了二进制数据。多谢。
Nov 28, 2017
Replied to a topic by PHizing Python 怎么把 bytearray 转换为二进制数据?
3. python 发布数据到 redis 代码:
redis_dict = dict()
for pid, rids in result.items():
redis_dict[pid] = 前面的序列化代码,把 rids 这个整型列表传进去,得到一个 bytearray 的 buffer

r = redis.Redis(host, port, db)
r.hmset(REDIS_TABLE, redis_dict)

4. 我也不知道是不是哪里用错了,初次开发这种底层的数据,还没搞清楚 bytes, bin, bytearray 这些数据的区别
5. 我想要的是字节流,不是那种看着可读的字符串。改了好几次代码,到 redis 上看到的是'\x85\x86'这样的,我就知道又不对。实际上,之前 C++写到 redis 的数据,用 hget REDIS_TABLE pid 去看,全部是乱码,那才是对的。
Nov 28, 2017
Replied to a topic by PHizing Python 怎么把 bytearray 转换为二进制数据?
类 C 代码: int a[100] = {1, 2, 3....};
char *b = new char[1000];
char *pb = b
for (i = 0; i < 99; ++i)
char *buffer = NULL;
size = convert_byte(a[i], buffer);
memcpy(pb, buffer, size)
pb += size
Nov 28, 2017
Replied to a topic by PHizing Python 怎么把 bytearray 转换为二进制数据?
综合大家的意见,说明下:
1. redis 的数据,一直以来都是给 C++程序使用,C 写 C 读。不过我改了一个子功能,把 C 写的改为 python 写,所以序列化的代码是不能改为 msgpack 或者是 json 的。
2. 序列化的代码,类似于一个整型数组,变成 byte 字节流:
类 C 代码: int a[100] = {1, 2, 3....}
Nov 27, 2017
Replied to a topic by PHizing Python 怎么把 bytearray 转换为二进制数据?
不是哦。
我希望 C++拿到的是一堆字节,这些字节没有“\\”这样的东西。现在明显是可显示的字符数据。
它的说明里面不是写着内置 145 卡号吗?激活才会变成正式卡号的。
May 22, 2017
Replied to a topic by Andor_Chen Python 送几本《流畅的 Python 》
我也来看下运气。
@oxoxoxox 有可能。否则手动检测不到说不过去。

@Aquamarine 国内市场,比如 apkpure 之类的。还不是酷安这些提供国内版本的市场。
@21grams 你是忽悠我的吗?
@Aquamarine 我没有对比过,但我发现其它市场的已经出了,play 还刷不出来。结果过一段时间忍着没更新,在 play 上就显示一个 2 周前的提示。
@oxoxoxox 我这主动刷新,也要推送啊?
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6083 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 226ms · UTC 03:36 · PVG 11:36 · LAX 20:36 · JFK 23:36
♥ Do have faith in what you're doing.