I have a code to create new f_name, l_name, email, id in my program, however it accepts any kind of input all variables. But, I want to limit the empty space/ whitespace to reject invalid input such as f_name, l_name, email, id
Asked
Active
Viewed 63 times
-1
-
https://stackoverflow.com/questions/33881152/validate-user-input-using-regular-expressions – ZabielskiGabriel Sep 16 '22 at 15:16
-
Does this answer your question? [Validate user input using regular expressions](https://stackoverflow.com/questions/33881152/validate-user-input-using-regular-expressions) – ZabielskiGabriel Sep 16 '22 at 15:17
-
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – user11717481 Sep 16 '22 at 15:17
-
Does this answer your question? [Check if string contains only whitespace](https://stackoverflow.com/questions/2405292/check-if-string-contains-only-whitespace) – Gino Mempin Sep 18 '22 at 01:53
1 Answers
0
if value is not None and hasattr(value, 'strip'):
return value.strip()
return value```

sergelab
- 120
- 3