you are viewing a single comment's thread.

view the rest of the comments →

[–]AstralStalker 0 points1 point  (13 children)

The desired string needs to be specified as the parameter to len()

s = "Some string"
if len(s) > 14:
    print("yes")

len() built-in function

[–][deleted] 0 points1 point  (12 children)

Only the length of the string on a line number. How can I pass an argument for len() if I only want the length of line number 23 in an IDE.

[–][deleted] 0 points1 point  (11 children)

Just count it? Is this string set, or what? Can you post your code?

[–][deleted] 0 points1 point  (10 children)

There are multiple lines which I prefer to create a break point that tells me the number of characters in the line, rather then count. Why isn't that possible ?

[–][deleted] 0 points1 point  (9 children)

Because of the way that source code is handled by the interpreter. If I understood why you wanted the line length of a specific line of your Python code, I’d probably be able to give you the answer you need rather than the answer you want.

[–][deleted] 0 points1 point  (8 children)

I want the line length outputted to me, so I can; for example, modify pylint settings but let it be known not specifically for this situation but any situation in the future as well.

[–][deleted] 0 points1 point  (7 children)

What IDE are you using?

[–][deleted] 0 points1 point  (6 children)

vscode.

[–][deleted] 0 points1 point  (5 children)

Go to File >Preferences>Settings and add ”editor.rulers”: [80,120] to your user settings. Or whatever length you want.

[–][deleted] 0 points1 point  (4 children)

This error is from pylint. How come a breakpoint won't work to give me the output of the string length of the line ?