简体   繁体   中英

How would I take a 3 digit number from a Tkinter entry and translate it into an IP address?

Let's say the prompt is, "What is the store number?" The user types in 123 and hits start and what's printed is an IP address in the form of "10.1.23.111" where [10] and [111] are always fixed.

Simple answer - you can't from just entering your 3 digits in your example (ie: 123) as any octet within an IPv4 address (###.###.###.###) can be a value between 0-255.

However, if you format the User's input to take that into consideration (ie: 1023) to create 10.1.023.111, that'll be significantly easier.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM