[Tutor] '.=' in Python ?

Zak Arntson zak@harlekin-maus.com
Mon May 5 16:36:23 2003


> Hi all,
> I just start learning Python as my (almost) first programming language.
>
> ------------------------------
>
> Here is my script...
>
<SNIP>
> f = open("/home/kiko/docs/serverList")
> line = f.readline()
> while line:
>     modLine = modLine + text + line	# *1
>     line = f.readline()
>
> f.close()
<SNIP>

You could also replace the modLine assignment line with

     modLine = '%s%s' % (text, line)

(I think. I'm a beginning Python programmer, too :)

-- 
Zak Arntson
www.harlekin-maus.com - Games - Lots of 'em