str length python code example
Example 1: python length
# to get the length of a string or array, use the len() method
my_string = "Hello World"
my_list = ["apple", "banana", "orange"]
print(len(my_string)) # outputs 11
print(len(my_list)) # outputs 3
Example 2: python 3 string length
#!/usr/bin/python3
str = "this is string example....wow!!!"
print ("Length of the string: ", len(str))