String length (len)

  • len

The len function returns the length of the string in number of characters.


examples/strings/length.py

line = "Hello World"
hw = len(line)
print(hw)  # 11

text = """Hello 
World"""
print(len(text))  # 12