[Tutor] Python record delimiter / record separator

Andy W toodles@yifan.net
Wed, 19 Dec 2001 18:53:29 +0800


Hi Hy,


> Is there a way to set a record delimiter in Python you while reading in a
> file?
> (Like $/ in Perl)

(n.b. I've never used Perl, I hope I'm understanding the question correctly)

Not as far as I know. You can just read in the data and split it, though.
ie.:-

my_file=open("the_file.extension")
data=my_file.read()
records=data.split(delimiter)

>
>
> Thanks a lot.
>
>
> Hy

No worries, hope this helps!

Andy

>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>