[Tutor] '.=' in Python ?

Brett Kelly bkelly@sourcereview.net
Mon May 5 16:46:21 2003


--19uQFt6ulqmgNgg1
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Oh, and as far as file i/o, the open() function is deprecated. use this:

myfile =3D file("somefile.txt", 'r')
mylist =3D myfile.readlines()
myfile.close()

etc.


Sometime around Mon, May 05, 2003 at 01:35:48PM -0700, Zak Arntson took the=
 liberty of imparting these morsels of brilliance:
> > Hi all,
> > I just start learning Python as my (almost) first programming language.
> >
> > ------------------------------
> >
> > Here is my script...
> >
> <SNIP>
> > f =3D open("/home/kiko/docs/serverList")
> > line =3D f.readline()
> > while line:
> >     modLine =3D modLine + text + line	# *1
> >     line =3D f.readline()
> >
> > f.close()
> <SNIP>
>=20
> You could also replace the modLine assignment line with
>=20
>      modLine =3D '%s%s' % (text, line)
>=20
> (I think. I'm a beginning Python programmer, too :)
>=20
> --=20
> Zak Arntson
> www.harlekin-maus.com - Games - Lots of 'em
>=20
>=20
>=20
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

--=20
Brett Kelly
bkelly@sourcereview.net

This message was created using the Mutt mail agent and=20
digitally signed using GnuPG.


--19uQFt6ulqmgNgg1
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+tswTa7gYa9SI8SoRAr5WAJ93Epc6EaiDmGj1CpscPcsgmXqutwCgipDc
qDojgm+yTyc9AROx5faC390=
=XQ4j
-----END PGP SIGNATURE-----

--19uQFt6ulqmgNgg1--