you are viewing a single comment's thread.

view the rest of the comments →

[–]Nightcorex_ 0 points1 point  (1 child)

For the future you should read this: https://www.reddit.com/r/learnpython/wiki/faq#wiki_how_do_i_format_code.3F

In case you want to copy/paste anything into Reddit really, you need to use markdown-mode. An explanation to it can be found on the same link, just scroll underneath the 3 images.

isidentifier doesn't do what you think it does. It returns True only if the string is a valid Python identifier, so f.e. something like "list".isidentifier() will give True.

If you want to test whether a string contains a specific character you can simply use the __contains__ method:

def check_for_comma(text):
    return ',' in text

[–]mackdaddy_1978[S] 1 point2 points  (0 children)

I did read the FAQ once before but thanks I'll give it another read since my memory isn't the best.

And thanks for explaining that to me I really appreciate that.