[Tutor] is it possible to embed data inside a script?

Joseph Paish jpaish@freenet.edmonton.ab.ca
Sat Jul 19 09:44:02 2003


can a person include the data that a script processes inside the script=20
itself? =20

i am in the process of converting a short perl script that processes=20
everything following __DATA__ instead of processing the contents of a=20
separate (very small) file.


stripped down perl code follows :

# -------------
my @lines =3D <DATA> ;

foreach (@lines) {
    # do stripped out processing of stuff following __DATA__
    }

__DATA__
abc 123
def 456
ghi 789

# --------


is there some way to achieve the same thing in python?

thanks

joe