ord() expected string of length 1, but int found
源代码是这样:
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的更多相关文章
- string.trim().length()的用法
public class Test{ public static void main(String args[]){ String data = " a bc "; //调用str ...
- 关于string的length
在C++里面,std::string的length()返回的是字节数,与编码方式有关. int main() { std::string s = "我是中国人"; std::cou ...
- 使用xadmin更新数据时,报错expected string or bytes-like object
expected string or bytes-like object 期望的字符串或类似字节的对象,一般为数据类型不匹配造成 本人在实际项目里发现的问题是: 数据库里的字段类型与django里mo ...
- 解决:error: Cannot fetch repo (TypeError: expected string or buffer)
同步源码,问题重现: Fetching project platform/external/libopus Fetching project repo error: Cannot fetch repo ...
- 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 问题:调用第三 ...
- 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 ...
- String.length()和String.getBytes().length
1.字符与字节 抛出如下代码: public static void main(String[] args) { String str = "活出自己范儿"; System.out ...
- TypeError: sequence item 0: expected string, Tag found
原始代码: soup = BeautifulSoup(result, 'html.parser') content_list = soup.find_all('p', attrs={"cla ...
- [Python]json对象转换出错expected string or buffer python
[问题] 今天在使用python中的json转换碰到一个问题: 错误显示: expected string or buffer json内容如下: {u'err_no': 0, u'corpus_no ...
随机推荐
- mysql数据库1
desc 表名; 显示表结构
- LeetCode(96): 不同的二叉搜索树
Medium! 题目描述: 给定一个整数 n,求以 1 ... n 为节点组成的二叉搜索树有多少种? 示例: 输入: 3 输出: 5 解释: 给定 n = 3, 一共有 5 种不同结构的二叉搜索树: ...
- Ubuntu 安装google 拼音
一.安装fcitx apt-get install fcitx 二.安装google pinyin sudo apt install fcitx-googlepinyin 三. 安装 fcitx-co ...
- C++ GetModuleFileName()
关于GetModuleFileName function,参考:https://msdn.microsoft.com/en-us/library/windows/desktop/ms683197(v= ...
- jQuery核心方法
1.$(document.body).css( "background", "black" ); 2.$(myForm.elements).hide():隐藏表 ...
- Appium Demo
import unittestimport timefrom appium import webdriverfrom public import configimport os #类继承unittes ...
- 微信小程序开发 如何退出当前页面
默认是在首页 wx.navigateBack({ delta: -1 }); 详情参考. https://mp.weixin.qq.com/debug/wxadoc/dev/api/u ...
- 2019-3-9,Servlet转跳链接详解
//以下代码,可以传递request和response对象及其属性和变量至指定页面 request.getRequestDispatcher("showAttribut.jsp") ...
- pandas之系列操作(一)
1.读Excel: # coding=utf-8 import pandas as pd import pymysql sql_select =" xxxxx " con = py ...
- STL用法大全
1. 概述 泛型编程思想最早缘于A.Stepanov提出的部分算法可独立于数据结构的论断.20世纪90年代初A.Stepanov和Meng Lee根据泛型编程的理论用C++共同编写了STL.但直 ...