[Newbie] Is the text delimiter changeable?

Emile van Sebille emile at fenx.com
Sun Jun 30 12:05:10 EDT 2002


"Ben Fairbank" <baf at texas.net> wrote in message
news:3d1f26a4.5915886 at news.texas.net...
> 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?
>

Python's text indicators (', ") don't appear in the content so you
should have no problems dealing with the content.

>>> s,t = "can't", '''"can't"'''
>>> s
"can't"
>>> t
'"can\'t"'
>>>



--

Emile van Sebille
emile at fenx.com

---------




More information about the Python-list mailing list