我在Rakudoc中找不到bytearray
方法或类似的方法。在Python中,bytearray定义如下:
class bytearray([source[, encoding[, errors]]])
Return a new array of bytes. The bytearray class is a mutable sequence of integers in the range 0 <= x < 256. It has most of the usual methods of mutable sequences, described in Mutable Sequence Types, as well as most methods that the str type has, see String Methods.
Raku应该提供这种方法还是一些模块?在
brian d foyanswer基本上是正确的。你几乎可以把this code翻译成Perl6
然而,宣言并不相同:
^{pr2}$在Python中相当于在perl6中
为了使用与错误转换等效的东西,由于perl6处理Unicode规范化的方式不同,这种方法是不同的;您可能必须使用^{} 编码。在
然而,对于大多数用途,我想
Buf
,正如brian d foy所指出的,是正确的。在我想你在找Buf-一个可变的(通常是无符号的)整数序列。用
:bin
打开文件将返回Buf
。在相关问题 更多 >
编程相关推荐