[Tutor] How to leave literal %s in output of formatted string

Adam Kessel adam@bostoncoop.net
Thu May 15 10:48:01 2003


--k3qmt+ucFURmlhDS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

This is a suggestion from one newbie to another--I'm sure there's a
better way to do this, but this worked:=20

VendorID =3D 'ACME'
ReplacementString =3D '%s'
s =3D '%s Download %s' % (VendorID, ReplacementString)

--Adam

On Thu, May 15, 2003 at 10:28:42AM -0400, Jeff Kowalczyk wrote:
> I want to build a format string in code. How do I leave a
> literal %s in my string formatting output? I can't find any
> escape code for the % character.
>=20
> (desired output)
> >>> VendorID =3D 'ACME'
> >>> s =3D '%s Download \%s' % VendorID
> 'Acme Download %s'

--k3qmt+ucFURmlhDS
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQE+w6hndTf3ZklQ6qYRAsL4AKCRjXpQCDh/lbAjApq+IaVX7cRQJwCghzcy
LMoPuV+bD1GpB89mcwh0h20=
=12OT
-----END PGP SIGNATURE-----

--k3qmt+ucFURmlhDS--