Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get string length
#1
To start off, I just want to print the length of a hard coded string as follows:

#!/usr/bin/env python3
#NestedIfStuff.py

password = "dink"

print(str(password.len()))
But I get the error: AttributeError: 'str' object has no attribute 'len'

What's wrong?
Reply


Messages In This Thread
Get string length - by RedSkeleton007 - Oct-21-2017, 04:31 AM
RE: Basic string manipulation - by metulburr - Oct-21-2017, 04:37 AM
RE: Get string length - by RedSkeleton007 - Dec-04-2017, 03:15 PM
RE: Get string length - by DeaD_EyE - Dec-04-2017, 03:19 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can i limit length string? perrfect 3 13,999 Feb-10-2020, 04:52 PM
Last Post: Jendker
  python gives wrong string length and wrong character thienson30 2 2,991 Oct-15-2019, 08:54 PM
Last Post: Gribouillis
  Highlight/Underline a string | ValueError: zero length field name in format searching1 1 3,017 Jul-01-2019, 03:06 AM
Last Post: metulburr
  calculating length of string desul 12 8,669 May-22-2019, 10:50 AM
Last Post: ankit
  Python find the minimum length of string to differentiate dictionary items zydjohn 3 3,615 Mar-03-2018, 05:23 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020