Python 我应该使用什么数据类型作为redis py函数的参数?

Python 我应该使用什么数据类型作为redis py函数的参数?,python,python-3.x,string,redis,byte,Python,Python 3.x,String,Redis,Byte,例如,当我使用时,我是否需要将每个参数转换为字节,或者这是由客户端自动完成的 xack(name, groupname, *ids) 似乎使用str或bytesid都有效,但我在文档中找不到对此的解释。相关源代码的链接将不胜感激。源代码注释是查看预期类型的良好参考str将在大多数情况下执行,但某些命令在某些参数中需要其他类型 例如,请参见: 您将在该文件中找到其他命令 Redis字符串是二进制安全的。您可以使用bytearray作为字符串。这里有一个 您也可以在键上使用bytearray。源注

例如,当我使用时,我是否需要将每个参数转换为字节,或者这是由客户端自动完成的

xack(name, groupname, *ids)

似乎使用
str
bytes
id都有效,但我在文档中找不到对此的解释。相关源代码的链接将不胜感激。

源代码注释是查看预期类型的良好参考
str
将在大多数情况下执行,但某些命令在某些参数中需要其他类型

例如,请参见:

您将在该文件中找到其他命令

Redis字符串是二进制安全的。您可以使用
bytearray
作为字符串。这里有一个


您也可以在键上使用
bytearray

源注释是查看预期类型的良好参考
str
将在大多数情况下执行,但某些命令在某些参数中需要其他类型

例如,请参见:

您将在该文件中找到其他命令

Redis字符串是二进制安全的。您可以使用
bytearray
作为字符串。这里有一个


您也可以在按键上使用
bytearray

但是我可以互换使用
str
bytes
吗?是的,扩展答案,请参见末尾,但是我可以互换使用
str
bytes
吗?是的,扩展答案,请参见末尾
def xclaim(self, name, groupname, consumername, min_idle_time, message_ids,
           idle=None, time=None, retrycount=None, force=False,
           justid=False):
    """
    Changes the ownership of a pending message.
    name: name of the stream.
    groupname: name of the consumer group.
    consumername: name of a consumer that claims the message.
    min_idle_time: filter messages that were idle less than this amount of
    milliseconds
    message_ids: non-empty list or tuple of message IDs to claim
    idle: optional. Set the idle time (last time it was delivered) of the
     message in ms
    time: optional integer. This is the same as idle but instead of a
     relative amount of milliseconds, it sets the idle time to a specific
     Unix time (in milliseconds).
    retrycount: optional integer. set the retry counter to the specified
     value. This counter is incremented every time a message is delivered
     again.
    force: optional boolean, false by default. Creates the pending message
     entry in the PEL even if certain specified IDs are not already in the
     PEL assigned to a different client.
    justid: optional boolean, false by default. Return just an array of IDs
     of messages successfully claimed, without returning the actual message
r.set(key, b'\xff\xf0\x00')