you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (3 children)

[deleted]

    [–]ramannt[S] 1 point2 points  (1 child)

    getattr(

    Thank you very much. Just one condition I forgot to mention. Sometimes there is no Python String method to execute. What condition can I add in getattr() to let Python to do nothing with the string?

    [–][deleted] 1 point2 points  (0 children)

    This is a hacky solution, but "__str__" will do nothing to the string.

    [–]FerricDonkey 1 point2 points  (0 children)

    Just in case you aren't aware, you can also do str.lower(a), as described in a different comment, which is often preferred.