"Python String Emptiness Test"

=> What's the most self-explanatory and safest way of checking if a Python string is empty?

Not a simple question, unfortunately, and no universal answer.

@r000t @x_cli Only if it's actually a string :)

object of type 'NoneType' has no len()

@x_cli @bcl Damn, never thought about someone passing an object that's straight up lying....

But testing for the string type solves a lot of that... maybe? Can you lie about that, too?


You could subclass str πŸ˜… But I guess this would be far-fetched. And you would be a str of sorts, so... πŸ™‚

Β· Β· Mastalab Β· 0 Β· 0 Β· 0
Sign in to participate in the conversation
Infosec Exchange

A Mastodon instance for info/cyber security-minded people.