Solved

simple way to check input format

Posted on 2011-09-16
3
252 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
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 28

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction On September 29, 2012, the Python 3.3.0 was released; nothing extremely unexpected,  yet another, better version of Python. But, if you work in Microsoft Windows, you should notice that the Python Launcher for Windows was introduced wi…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now