[Newbie] Is the text delimiter changeable?

John La Rooy larooy at xtar.co.nz
Sun Jun 30 18:41:13 EDT 2002


On Sun, 30 Jun 2002 15:49:16 GMT
baf at texas.net (Ben Fairbank) wrote:

> I have to process large amounts of text and the text includes numerous
> apostrophes and quotation marks.  It would be very handy if I could
> temporarily assign a substitute for Python's use of the caracters "
> and ' to delimit text strings.  If I could use, for example, the @
> character or the # character, neither of which appears in the text I
> have to work with, and if I could disable the " and ' delimiters, then
> my task would be greatly simplified.  I realize I can backslash escape
> these characters in some circumstances, but I do not think that will
> work when a user's input is a word such as "can't" or "don't."
> Anyway, short of doing something truly drastic, such as recompiling
> the system (which I have no intention of doing), is there a workaround
> that will permit this?
> 
> Thank you,
> 
> BAF

You don't say where is the text coming from. The quotes aren't used as
delimiters except when you are working with source. 

for instance if you have a line like this in your script
s="can't"


if you are using
s=rawinput()
or
s=some_file.read()

the quote don't have any special meaning at all


just wondering as you referred to the "user's input" it doesn't sound
like the user is writing python code


John



More information about the Python-list mailing list