# What is the maximum length of string in Python?

PythonServer Side ProgrammingProgramming

Maximum length of a string is platform dependent and depends upon address space and/or RAM. The maxsize constant defined in sys module returns 263-1 on 64 bit system.

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


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

Published on 28-Dec-2017 10:04:47