how to include text data in source code?

Paddy paddy3118 at googlemail.com
Fri Feb 1 10:20:24 EST 2008


On Feb 1, 2:28 pm, "Sun" <a... at hut.at> wrote:
> as the subject, I 'd like to know how to include a piece of text as input in
> the source code so that I do not need to read in data from files. I remember
> there is some thing like this in Perl, have no idea if python has the same
> thing?
>
> Thanks.

Heres a pointer to the use of the stringio module used to make text
look like a file:
http://en.wikipedia.org/wiki/Doctest#Example_3:_unique_words.py

- Paddy.



More information about the Python-list mailing list