Solved

simple way to check input format

Posted on 2011-09-16
3
258 Views
Last Modified: 2012-05-12
is there a simple way to check input format... im using wxpython and collecting data in wxTextctrl... meaning I have to have people input an ip address... I 'm wondering if I can check that it is  at least in the correct  format
ie xxx.xx.xx.xxx ....
0
Comment
Question by:dolamitejenkins
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Accepted Solution

by:
speak2ab earned 500 total points
ID: 36553001
A similar question has been discussed on this forum:
http://stackoverflow.com/questions/319279/how-to-validate-ip-address-in-python

The info there should put you on the right track.

0
 
LVL 29

Expert Comment

by:pepr
ID: 36553391
I absolutely agree with speak2ab (he should get the points). The reason is that the socket is the standard module. It it implemented in binary (you will hardly reach that efficiency in Python), it is ready to be used, it is based on the related RFC's (i.e. standards), it may check the IP the way that you even do not know that it should be checked so (you can check easily in Python that they are 4 integer of a limited range separated by dots, but it may not be enough), it supports IPv6 that may be important for you after a while.  And it is likely that you may need its other functionality anyway.
0
 

Author Closing Comment

by:dolamitejenkins
ID: 36578402
thanks
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"The time has come," the Walrus said, "To talk of many things: Of sets--and lists--and dictionaries-- Of variable kinks-- And why you see it changing not-- And why so strange are strings." This part describes how variables and references (see …
Variable is a place holder or reserved memory locations to store any value. Which means whenever we create a variable, indirectly we are reserving some space in the memory. The interpreter assigns or allocates some space in the memory based on the d…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question