![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
张执行
这个作者很懒,什么都没留下…
展开
-
python字符串去掉前缀b
python程序从管道中读取到的字符串(管道的写端为c程序)有前缀b,data = os.read(rf, 1024)如下图:需要去掉字符串的前缀b,只需要进行utf-8的转换即可,即:data = data.decode(“utf-8”).原创 2020-06-12 23:23:24 · 15983 阅读 · 3 评论 -
python中字符串的比较
本文转载刘荣星的博客,原文链接:https://www.liurongxing.com/python-is-cmp-compare-operator.html在 Python 中比较字符串最好是使用简单逻辑操作符。例如,确定一个字符串是否和另外一个字符串匹配。可以使用 is equal 或 == 操作符,也可以使用 >= 或 < 来确定几个字符串的排列顺序。从官方文档看:The operators ``is`` and ``is not`` test for object identi转载 2020-06-12 21:47:22 · 2070 阅读 · 0 评论