gpt4 book ai didi

python - jython 中字符函数参数的最大长度是多少?

转载 作者:太空宇宙 更新时间:2023-11-04 01:38:34 29 4
gpt4 key购买 nike

python/jython 中字符函数参数的最大长度是多少?

我已经查看了 python.org 上的文档,但没有成功

最佳答案

Python 通过引用传递函数参数,因此传递给函数的字符串的最大长度完全取决于字符串的最大长度。

碰巧字符串的最大长度取决于平台(通常是地址空间和/或 RAM)- 参见问题 What is the max length of a Python string了解详情。

在 python 中(我假设这也适用于 jython)你可以用 sys.maxsize 找到这个值:

>>>import sys
>>>print sys.maxsize
9223372036854775807

来自文档:

maxsize: The largest positive integer supported by the platform’s Py_ssize_t type, and thus the maximum size lists, strings, dicts, and many other containers can have.

请注意,您的最大长度字符串不会超过这么多字符。

关于python - jython 中字符函数参数的最大长度是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7424761/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com