[Tutor] another couple of questions
Todd Martin
todd@royalbastard.com
Thu, 3 Jun 1999 10:11:30 -0700
Ok so I can now create a file and name it what I want to name it, I can
write to it and all seems ok.
Now I have this shell script that I use for dealing with IP address's and
what it does essentially is takes an IP, breaks it down to its 4 octets like
255.255.255.255 and stores each octet into its own variable, like $OCT1, $OCT2,
$OCT3, and $OCT4. By doing that I can add and subtract from $OCT4 and glue it
all bake together again.
So if I have 111.111.111.111 and I want to give a list of usuable IP's for a
customer I can just add to $OCT4 and produce 111.111.111.112 etc......
How can I do this in python?
-----------------------------
Second question
-----------------------------
I can print to a file, but how do I read a template into a file? For instance
I want to have a file called "foc" that I can read into a file. I would also
like to be able to change certain fields in the template, for instance
Name: username
Address: address
I would like the program to prompt the user for the variable address (username
is given as an argument via argv[1]) then fill in the appropriet field in the
template.
--
Todd Martin
todd@royalbastard.com
http://royalbastard.com/~todd