Python:String Length

From Progzoo
Jump to: navigation, search

Use len(string) to get the number of characters.

s                   len(s)          

one                 3                   
two                 3                   
three               5                   
four                4                   


[Font] [Default] [Show] [Resize] [History] [Profile]

len() can also be used to get the length of a list.