首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏网络安全技术点滴分享

    Intigriti Bug Bytes

    Intigriti Bug Bytes #226 - 2025年7月 作者:Intigriti | 2025年7月18日 目录黑客动态 INTIGRITI 0625挑战赛结果 平台最新功能 技术博客与视频 工具与资源 幕后花絮 反馈建议 黑客动态欢迎阅读最新版Bug Bytes

    10300编辑于 2025-08-10
  • 来自专栏Golang开发

    Golang包——bytes

    ; i < b.N; i++ { str.String() } } func BenchmarkByteBuffer(b *testing.B) { byte := bytes.Buffer

    56920发布于 2019-05-29
  • 来自专栏python3

    python bytes to stri

    b"qwert".decode("utf-8)

    47130发布于 2020-01-06
  • 来自专栏python3

    Python - 了解bytes、str

    #在Python3中,我们需要编写接受str或bytes,并总是返回str的方法: def to_str(bytes_or_str):   if isinstance(bytes_or_str, bytes ):     value = bytes_or_str.decode('utf-8')   else:     value = bytes_or_str   return value # Instance  of str    #另外,还需要编写接受str或bytes,并总是返回bytes的方法: def to_bytes(bytes_or_str):   if isinstance(bytes_or_str , str):     value = bytes_or_str.encode('utf-8)   else:     value = bytes_or_str   return value # Instance 要点: - 在Python3中,bytes是一种包含8位值的序列,str是一种包含Unicode字符的序列。开发者不能以>或+等操作符来混同操作bytes和str实例。

    1.4K10发布于 2020-01-09
  • 来自专栏小白程序猿

    Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in

    今天在使用laravel框架安装图形验证码时需要了报错,错误如下: Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver

    1.7K20发布于 2020-11-23
  • 来自专栏每日一篇技术文章

    字节bytes的操作大全

    a = []byte("我爱你") var c rune = '我' fmt.Println(bytes.ContainsRune(a,c)) } ? ("xj-abcdef") var b = []byte("ef") fmt.Println(bytes.HasSuffix(a,b)) } ? []byte("xj-我abcdef") var b = byte('e') fmt.Println(bytes.IndexByte(a,b)) } ? ("%s\n", bytes.Replace([]byte("121416"),[]byte("1"),[]byte("a"),2)) } ? { fmt.Printf("%s",bytes.Split([]byte("abcdef"),[]byte("d"))) } ?

    58010发布于 2019-05-26
  • 来自专栏python3

    python bytes类型转换

    python bytes 类型转换 bytes,字节: 而一系列不可改变的介于0-255之间的数字被称为bytes对象。 不能对bytes对象直接复制,可以将bytes转换为一个bytearray对象,bytearray对象是可以被修改的。                     barr = batearray(bytes_object)       bytes对象和string不可以混在一起: print(by+str) 导致错误:TypeError: can't concat bytes to str bytes对象有一个decode()方法,向该方法传递一个字符编码参数,该方法会返回使用该种编码解码后的字符串。

    2.1K10发布于 2020-01-07
  • 来自专栏python3

    Python中的bytes

    bytes_lst = [   ('创建bytes',),   ('bytes可哈希',),   ('编码与解码',),   ('常见编码类型',),   ('ord() 与 chr()',), ] 创建 bytes >>>b = bytes('hi', 'utf-8')   >>>type(b)   <class 'bytes'> bytes可哈希 >>> hash(b'hi')   -4078898686365756139 编码与解码 >>>b = 'hi'.encode('utf-8')   >>>type(b)   <class 'bytes'> >>>s = b.decode('utf-8')   >>>type

    57610发布于 2020-01-20
  • 来自专栏Go学习

    Go标准库:bytes

    Go 语言的标准库 bytes 包提供了一组用于操作字节切片 ([]byte) 的函数。这个包中的函数与 strings 包中的函数非常类似,但它们操作的是字节切片,而不是字符串。 bytes 包提供了很多处理字节切片的工具,包括但不限于查找、比较、切分、连接、替换、转换等操作。1. 缓冲区操作bytes.Buffer 类型提供了一个用于高效地读写字节的缓冲区。func (b *Buffer) Bytes() []byte: 返回缓冲区中的字节切片。

    38410编辑于 2024-08-09
  • 来自专栏计算机视觉理论及其实现

    str、bytes和bytearray编码

    不难看出,它们是一种根据编码表进行翻译、映射的过程:编码:str --> bytes解码:bytes --> str实际上,字符串类型只有encode()方法,没有decode()方法,而bytes 构造bytes的方式:# 构造空bytes对象>>> bytes()b''# 使用str构造bytes序列,需要指定编码>>> bytes("abcd",encoding="utf-8")b'abcd' # 使用int初始化5个字节的bytes序列>>> bytes(5)b'\x00\x00\x00\x00\x00'# 使用可迭代的int序列构造字节序列# int值必须为0-256以内的数>>> bytes ([65,66,67])b'ABC'# 使用bytes或buffer来构造bytes对象>>> bytes(b'abcd')b'abcd'构造bytearray的方式:# 够造空bytearray对象> 例如,使用utf-8编码"我"字,得到一个bytes序列,然后使用gbk解码这个bytes序列。

    1.6K20编辑于 2022-09-03
  • 来自专栏我的知识小屋

    solidity bytes 智能合约开发知识浅学(五点一)bytes基本概念

    bt1 = "a"; // byte 等价 bytes1 bytes2 bt2 = "ab"; function getbBytes() public constant returns (bytes1,bytes2){ return (bt1,bt2); } function getbBytesLength() public constant returns (uint,uint){ return (bt1.length,bt2.length); } } bytes1 后面数字1是表示1字节 bytes默认等于bytes1 Bytes2 后面数字2是表示2字节 Bytes3 后面数字3是表示3字节 bytes4 后面数字4是表示4字节 代码解析: bytes1 bt1 = “a”; bytes2 bt2 = “ab”; 声明定义两个 bytes变量bt1与bt2,值分别为a和ab function getbBytes() public constant returns(bytes1,bytes2): 名为getbBytes的函数返回两个值

    1.9K10发布于 2020-10-23
  • 来自专栏猿说编程

    44.python bytes函数

    bytes是字节序列,值得注意的是它有取值范围:0 <= bytes <= 255; 一.bytes函数简介 python bytes字节序列有以下几种使用方式: """             bytes (iterable_of_ints) -> bytes             bytes(string, encoding[, errors]) -> bytes             bytes( bytes_or_buffer) -> immutable copy of bytes_or_buffer             bytes(int) -> bytes object of size empty bytes   # 2.定义指定个数的字节序列bytes,默认以0填充,不能是浮点数 bytes(int) -> bytes of size given by the parameter .bytes函数使用 1.定义空的字节序列bytes # !

    1.5K30发布于 2020-03-12
  • 来自专栏小孟开发笔记

    unserialize(): Error at offset 0 of 10898 bytes

    thinkphp5 unserialize(): Error at offset 0 of 932 bytes 该问题一般是用了git导致的 ThinkPHP5框架 在thinkphp\library\ 一般解决完,后续就ok了 未经允许不得转载:肥猫博客 » unserialize(): Error at offset 0 of 10898 bytes

    1.5K30编辑于 2023-02-20
  • 来自专栏ClickHouse

    Bytes KB MB TB PB..

    = (1L<<n)1KB = 1024 Bytes = 2^10 Bytes = (1L << 10) Bytes1Page = 4KB = 4096 Bytes = 4 * 1024 Bytes = 2^2 * 2^10 Bytes = 2^12 Bytes = (1L << 12) Bytes1Block = 1M = 1024 * 1KB = 1048576 Bytes = (1L << 20) Bytesso1MB = (1L << 20) Bytes128MB = (128L << 20) Bytes1GB=(1024 * 1MB) = (1L < 30)Bytes

    1.3K21编辑于 2023-03-02
  • 来自专栏Antony iOS Development

    3个bytes, 怎么接?

    问题 在过去的项目中,所接触到的「协议/指令(protocol/command)」,数据大多是以1个byte(字节),2个bytes,4个bytes,8个bytes......为单位进行切割组合的。 为单位的数据——有3个bytes的mac地址(截取了mac地址的一半,发送/广播给手机端),也有3个bytes的大气压数据。 所以定义了3 bytes~ ... 扯远了,继续:拿到这3个bytes后,第一反应就是NSData对象——于是就变着法把这三个bytes捣鼓成NSData对象: // 将3个bytes重新组合起来 Byte pressureBytes 另外,还试过定义成char *mac形式,不work,因为sizeof(cmd->mac)是8,一个指针占用了8 bytes,并不是我们想要的3bytes。 所以, 还要继续熟悉C语言。 毕

    1.8K20发布于 2019-02-14
  • 来自专栏python3

    python str与bytes之间的转

     # bytes object   b = b"example"   # str object   s = "example"   # str to bytes   bytes(s, encoding  = "utf8")   # bytes to str   str(b, encoding = "utf-8")   # an alternative method   # str to bytes   str.encode(s)   # bytes to str   bytes.decode(b)

    76020发布于 2020-01-14
  • 来自专栏C/C++基础

    Golang bytes.Buffer 用法精述

    1.简介 bytes.Buffer 是 Golang 标准库中的缓冲区,具有读写方法和可变大小的字节存储功能。缓冲区的零值是一个待使用的空缓冲区。 定义如下: type Buffer struct { buf []byte // contents are the bytes buf[off : len(buf)] off int var b bytes.Buffer //直接定义一个Buffer变量,不用初始化,可以直接使用 b := new(bytes.Buffer) //使用New返回Buffer 变量 b := bytes.NewBuffer(s []byte) //从一个[]byte切片,构造一个Buffer b := bytes.NewBufferString(s string) / [2] Golang buffer.go [3] Golang之缓冲器bytes.Buffer

    18.1K30发布于 2019-07-03
  • 来自专栏python3

    Python内置数据结构——bytes,bytearray

    bytes,bytearray 字符串与bytes 字符串是字符组成的有序序列,字符可以使用编码来理解 bytes是字节组成的有序的不可变序列 bytesarray是字节组成的有序的可变序列 编码与解码 字符串按照不同的字符集编码encode返回字序列bytes             bytes.encode(encoding = 'utf - 8',errors = 'stirct') -> bytes 定义 bytes() 空bytes bytes(int) 指定字节bytes,被0填充 bytes(iterable_of_ints) -> bytes[0~255] 的int组成的可迭代对象 bytes (string,encodeing[,errors]) -> bytes  等价于string.encode() bytes(bytes_or_buffer) -> immutable copy of 使用16进制表示b'\x41\x61' bytes操作 和str类型类似,都是不可变类型,所以方法很多都一样,只不过bytes的方法,输入是bytes,输出是bytes b'abcdef'.replace

    2K10发布于 2020-01-08
  • 来自专栏python3

    Python3 上 bytes 和 s

    >>> help(bytes.translate) Help on method_descriptor: translate(...) table Translation table, which must be a bytes object of length 256. Python2 中有 str 和 Unicode 两种类型,而 Python3已经严格区分了 bytes 和 str 两种数据类型,str为原来的unicode,bytes代替了之前的str。 而使用 bytes 类型,实质上是告诉 Python,不需要它帮你自动地完成编码和解码的工作,而是用户自己手动进行,并指定编码格式。 现在你不能在需要 bytes 类型参数的时候使用 str 参数,反之亦然。

    64510发布于 2020-01-02
  • 来自专栏Zkeq

    Python 字符串与bytes的转换

    字符串与bytes的转换 什么是bytes(比特类型) 二进制的数据流–bytes 一种特殊的字符串 字符串前 + b 标记 内置函数dir可以查到该数据类型的相关说明 字符串转bytes的函数 –encode 功能 将字符串转成比特(bytes)类型 用法 sring.encode(endocing='utf-8', errors= 'strict') 参数 encoding:转换的编码格式 ,如ascii , gbk , 默认 utf-8 errors : 出错时的处理方法 , 默认strict 直接抛错误 , 也可以选择 ignore 忽略错误 返回值 返回一个比特(bytes)类型 bytes转字符串的函数–decode 功能 将比特(bytes)类型转成字符串 用法 bytes.decode(encoding='utf-8', errors='strict') 参数 encoding

    95520编辑于 2022-05-18
领券