[python] quote % in shell script

Gerrit Holl gerrit at nl.linux.org
Sun May 11 05:18:07 EDT 2003


> From: Wolfgang Wilhelm <muelltonne2003 at etechnik.fh-koblenz.de>

> How do i escape the percent correct?

You can use '%%':

 33 >>> print "The planet %s surface consists for %d%% of water" % ("Earth", 70)
The planet Earth surface consists for 70% of water

See also: http://www.python.org/dev/doc/devel/lib/typesseq-strings.html

yours,
Gerrit.

-- 
141. If a man's wife, who lives in his house, wishes to leave it,
plunges into debt, tries to ruin her house, neglects her husband, and is
judicially convicted: if her husband offer her release, she may go on her
way, and he gives her nothing as a gift of release. If her husband does
not wish to release her, and if he take another wife, she shall remain as
servant in her husband's house. 
        -- Hammurabi, Code of Law
--
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
	http://www.sp.nl/





More information about the Python-list mailing list