Thanks, everyone!
On 8/16/05, Michael Lange <[EMAIL PROTECTED]> wrote: > On Mon, 15 Aug 2005 22:51:20 -0400 > Kent Johnson <[EMAIL PROTECTED]> wrote: > > > I think Luke's suggestion will work if you use f.read() (to read the whole > > file as a single string) instead of f.readlines() and f.write() instead of > > writelines(). > > > > Kent > > > > And if you want to convert ascii into unicode you need to call * decode() * ( > which does pretty much the same as unicode() ) > on the string, not encode() . > > Michael > > > luke wrote: > > > List: > > > I'm forwarding this private message(hope you don't mind Denise) > > > I personally have no idea what to do, but > > > someone else might be able to help. > > > -Luke > > > > > > > > > ----- Forwarded Message ----- > > > > > > text is a list, so you can't encode it. but you can iterate over each > > > of the elements and encode them. I have tried several variations of > > > that, but keep ending up with all my newlines being little boxes. any > > > ideas? > > > > > > Thanks, > > > Denise > > > > > > On 8/15/05, luke <[EMAIL PROTECTED]> wrote: > > >>I dont know much about Unicode but it seems like > > >>f = file(filename, "r") > > >>text = f.readlines() > > >>text = text.encode() > > >>#or maybe just text.encode()? > > >>f.close() > > >> > > >>should encode the filetext to unicode. > > >>then you could do a > > >>f = file(filename, "w") > > >>f.writelines(text) > > >>f.close() > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > http://mail.python.org/mailman/listinfo/tutor > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor