check size of string in python

To check the size of a string in Python, you can use the built-in len() function. The len() function returns the number of characters in a string. Here's an example:

main.py
my_string = "Hello, World!"
print(len(my_string)) # Output: 13
63 chars
3 lines

In this example, len() returns the length of the string my_string, which is 13.

related categories

gistlibby LogSnag