Verify input as integer and not blank - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Verify input as integer and not blank (/thread-27795.html) |
Verify input as integer and not blank - GMCobraz - Jun-22-2020 parallel = self.gui2.parallel_config() parallel_text = int("".join(map(str, parallel))) if parallel_text != int and parallel_text != '': QMessageBox.warning(self, '', 'Please input integer only in parallel and series', buttons=QMessageBox.Yes) return parallel is a list. I could not get it work. How could I verify the the input as integer only, not other? The problem for 'parallel' is a list. Even I input integer, it still show warning. Thats why I change the list to integer. Please help, thanks. RE: Verify input as integer and not blank - ndc85430 - Jun-22-2020 int raises a ValueError if what you give it can't be converted to an integer, so handle that with try and except .
RE: Verify input as integer and not blank - GMCobraz - Jun-22-2020 Thanks for the feedback RE: Verify input as integer and not blank - pyzyx3qwerty - Jun-22-2020 Note to use proper code tags in the future - see proper Code Tag Usage |