[Tutor] latest version and results.

Kirk Bailey deliberatus@my995internet.com
Thu, 22 Nov 2001 02:41:06 -0500


ok. here is the latest version of teh script:
-------------isolated bits barrier----------------
#!/usr/local/bin/python
# above line makes the file executable. MAKE SURE the X bit is SET
# on the file's permissions with chmod, such as chmod 755 (filename)!
#
# these next 2 are so the variqbles already have population and type-
strings.
# is this important?
#
# let's get the input from the user.
#
domain = raw_input("What domain name should I add? ")
print "Domain =", domain
infile = raw_input("What file should I read please? ")
print "I will read from a file named ", infile
outfile = raw_input("What file should I write out please? ")
print outfile
print "\n"
print "I will write results to the screen and a file named ", outfile
print "I will read each item in", infile, "and add \'@\' and ", domain,
"to it,"
print "and write the results to", "outfile, and also print them to the
screen."
print

inf = open(infile,"r")
out = open(outfile,"w")

for line in inf.readlines():
        addr = line.strip() + "@" + domain
        print addr
        out.write(addr+"\n")

out.close()
inf.close()

print "All done!"
print "\n"

-------------isolated bits barrier----------------
And it produced these results:
---------------babble------------------

$ ./filedomainadd.py
What domain name should I add? howlermonkey.net
Domain = howlermonkey.net
What file should I read please? list1
I will read from a file named  list1
What file should I write out please? list2
list2


I will write results to the screen and a file named  list2
I will read each item in list1 and add '@' and  howlermonkey.net to it,
and write the results to outfile, and also print them to the screen.

Traceback (innermost last):
  File "./filedomainadd.py", line 26, in ?
    addr = line.strip() + "@" + domain
AttributeError: 'string' object has no attribute 'strip'
$ 
-----------------end-------------------------------

intresting, seems something wants an attribute, and I do not comprehend
what STRIP is or deos, I just took the code offered and implemented it.
WTF, over please?

-- 
Respectfully,
             -Kirk D Bailey (C)2001
              Addme! icq #27840081
end
      My Sites:
      http://www.howlermonkey.net/ - free REAL email! list service soon!
      http://www.sacredelectron.org/ - Rants! Spleenvents!
      http://www.minorfish.org/ - The list server for some of us!

Message of the week:
R5L9W SDPQW UVN7V RUBWB I6HFP WVCUT VWRVL
W7812 LVH8V JBVK2 3CEJB TO8P3 FHFHG H7BFM
QID68 6DN6F 6M486 YQNCF JECQP 86CNP 86CTT
JIQPF ZPVGV DLFST DBUDI UIFNC BTUBS ETBOE
BTTGV DLUIF NSFBM IBSE!