源代码是这样:

s=b'^SdVkT#S ]`Y\\!^)\x8f\x80ism'

key=''

for i in s:
     i=ord(i)-16
     key+=chr(i^32)

print (key)

运行后出现了问题:ord() expected string of length 1, but int found

之所以出现这个问题,是在字符串转换过程中出现了一个小错误,在一系列百度和谷歌后,发现概念还是很迷糊,但是在曙光大佬的解答后,明白了怎么处理,就是在s后加””,运行后发现完美解决

ord() expected string of length 1, but int found的更多相关文章

  1. string.trim().length()的用法

    public class Test{ public static void main(String args[]){ String data = " a bc "; //调用str ...

  2. 关于string的length

    在C++里面,std::string的length()返回的是字节数,与编码方式有关. int main() { std::string s = "我是中国人"; std::cou ...

  3. 使用xadmin更新数据时,报错expected string or bytes-like object

    expected string or bytes-like object 期望的字符串或类似字节的对象,一般为数据类型不匹配造成 本人在实际项目里发现的问题是: 数据库里的字段类型与django里mo ...

  4. 解决:error: Cannot fetch repo (TypeError: expected string or buffer)

    同步源码,问题重现: Fetching project platform/external/libopus Fetching project repo error: Cannot fetch repo ...

  5. WCF常见异常-The maximum string content length quota (8192) has been exceeded while reading XML data

    异常信息:The maximum string content length quota (8192) has been exceeded while reading XML data 问题:调用第三 ...

  6. The maximum string content length quota (8192) has been exceeded while reading XML data

    原文:The maximum string content length quota (8192) has been exceeded while reading XML data 问题场景:在我们W ...

  7. String.length()和String.getBytes().length

    1.字符与字节 抛出如下代码: public static void main(String[] args) { String str = "活出自己范儿"; System.out ...

  8. TypeError: sequence item 0: expected string, Tag found

    原始代码: soup = BeautifulSoup(result, 'html.parser') content_list = soup.find_all('p', attrs={"cla ...

  9. [Python]json对象转换出错expected string or buffer python

    [问题] 今天在使用python中的json转换碰到一个问题: 错误显示: expected string or buffer json内容如下: {u'err_no': 0, u'corpus_no ...

随机推荐

  1. opencv 图像矫正

    四个坐标系的转换:https://blog.csdn.net/humanking7/article/details/44756073 标定和矫正:https://blog.csdn.net/u0134 ...

  2. 【python】给正则匹配部分命名

    可以用?P<name>的方法给正则匹配的部分命名. 例:要将<字母,数字>的部分命名为test x = "abc <haha,123> test @@&q ...

  3. 【深度学习】吴恩达网易公开课练习(class1 week2)

    知识点汇总 作业内容:用logistic回归对猫进行分类 numpy知识点: 查看矩阵维度: x.shape 初始化0矩阵: np.zeros((dim1, dim2)) 去掉矩阵中大小是1的维度: ...

  4. MySQL----数据库简单操作

    启动服务 net start mysql57断开服务 net stop mysql57连接服务 mysql -u root -p断开连接 exit|quit查看版本 select version(); ...

  5. 分布式事务XA

    1.什么是分布式事务 分布式事务就是指事务的参与者.支持事务的服务器.资源服务器以及事务管理器分别位于不同的分布式系统的不同节点之上.以上是百度百科的解释,简单的说,就是一次大的操作由不同的小操作组成 ...

  6. Docker相关释义

    Docker相关释义 基础网站:http://www.runoob.com/docker/docker-tutorial.html Docker的思想来自于集装箱,集装箱解决了什么问题?在一艘大船上, ...

  7. HDU 1671 Phone List (qsort字符串排序与strncmp的使用 /字典树)

    Phone List Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  8. mac pro 基本使用

    command+空格  调出搜索框 可以输入:网络,就是配置ip等信息 可以输入:终端,就是命令行窗口 可以输入:触控板,可以调节多点触控版 可以输入:系统偏好设置,进行配置 触控板:多点触控——两个 ...

  9. OpenCV-Python入门教程1-图片

    首先感觉学习OpenCV-python最好的学习工具官方的英文文档. 官方英文教程:OpenCV-Python Tutorials 我使用的是anaconda里的 jupyter notebook.至 ...

  10. 【C++ Primer | 07】泛型算法

    定制操作 #include <iostream> #include <string> #include <vector> #include <algorith ...