So I am creating a string as follows;
basic_punc = ' \n.,/?!:;()[]{}-~&\"\'—'
I am trying to use the escape character to include the apostrophe in my string, so that in my code:
if (not char.isalnum()) & (not char in basic_punc):
# Do the rest of my function here....
Where char is the character that I am looking at. However, my code does not seem to recognize the apostrophe as belonging to my basic_punc. I have tried enclosing the string in double quotes, removing the escape character, yet my function continues to see the apostrophe as not a part of the string that I created. What can I do? I am using jupyter notebook if that is relevant at all.
Aucun commentaire:
Enregistrer un commentaire