Home Python print result to variable with correct formatting
Reply: 0

Python print result to variable with correct formatting

user999 Published in May 24, 2018, 4:00 pm

I have a script that uses raw_input to enter a IPv4 IP address in CIDR format.

# Get address string and CIDR string from command line
sys.argv = raw_input("Type IPv4 address in CIDR format ")
(addrString, cidrString) = sys.argv.split('/')

The functions defined in the script converts the user inputted CIDR ( to normal IPv4 format.

Print result with code: print addrString, ".".join(map(str, mask)) outputs to screen as which is correct. But when I assign addrString, ".".join(map(str, mask)) to a variable, like var2 = addrString, ".".join(map(str, mask)) it's shown as ('', '')

How can i strip the unneeded signs like






when assigning to a variable?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.335135 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO