Variable + String Format

Joel Ross joelc at cognyx.com
Tue Feb 10 11:03:06 CET 2009


Hi all,

I have this piece of code:
#########################################################################

wordList = "/tmp/Wordlist"
file = open(wordList, 'r+b')


def readLines():

         for line in file.read():
             if not line: break
             print line + '.com '
             return line



readLines()
file.close()

##########################################################################

It returns the results:

t.com

NOTE: Only returns the first letter of the first word on the first line 
e.g. test would only print t and readline() does the same thing.

I have also tried readlines() which gives me the result:

test
.com

The file Wordlist has one word on each line for example

test
test1
test2

I need it to loop though the Wordlist file and print/return the results

test.com
test1.com
test2.com

I'm just looking for a point in the right direction.

Much Thanks

JOelC



More information about the Python-list mailing list