3 ms·
Shouldn't you use the match returned from the string? Or use .fullmatch() (added 3.4) to match the whole string.
by extraduder_ire 9mo ago
Shouldn't you use the match returned from the string? Or use .fullmatch() (added 3.4) to match the whole string.
- theamk 9mo agoIn general no, you should not use match from the string. If you are getting input from user, you want a more complex processing (like stripping all whitespace), and if you are getting input from API calls, you want to either use specified name as-is, or fail. Yes, fullmatch() will help, and so will \Z. It's just that it is so easy to forget...