![]() ![]() Print('The line does not end with \'language\'. Print('The line ends with \'language\'.') In the following example, we will check if the given string Python is a programming language ends with a specific word language or not. 'theword$' Example 1: Check if String ends with a Word The Regular Expression to check if string ends with the word is as shown in the following. We will use re.search() function to do an expression match against the string. To check if a string ends with a word in Python, use the regular expression for “ends with” $ and the word itself before $. Python Regex – Check if String ends with Specific Word Example 2: Check if String ends with a Word. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |