Python String Length


String Length

To get the length of a string, use the len() function.

Example

The len() function returns the length of a string:

a = "Hello, World!"
print(len(a))
Try it Yourself »


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.