Thank you to everyone! I changed the txt mode for my system, from 'wb' to 'w' and finally I got what I need.
Than you! 2011/3/28 <tutor-requ...@python.org> > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with subject or body 'help' to > tutor-requ...@python.org > > You can reach the person managing the list at > tutor-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Tutor digest..." > > > Today's Topics: > > 1. Re: Pygame install help (Wayne Werner) > 2. Re: Write new line(enter) in txt (Susana Iraiis Delgado Rodriguez) > 3. Re: Write new line(enter) in txt (Joel Goldstick) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 28 Mar 2011 10:27:25 -0500 > From: Wayne Werner <waynejwer...@gmail.com> > To: Chuck <duxc...@gmail.com> > Cc: tutor@python.org > Subject: Re: [Tutor] Pygame install help > Message-ID: > <aanlktinacrdgdsj4zkozb_gov6nf1+i8t_dcaoxfa...@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > On Sun, Mar 27, 2011 at 12:31 PM, Chuck <duxc...@gmail.com> wrote: > > > Does anyone have familiarity with installing pygame? It seems simple and > > straight forward enough, then why do I get the following from IDLE? This > is > > the 3.1 Windows pygame .msi install... > > > > Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] > > on win32 > > Type "copyright", "credits" or "license()" for more information. > > >>> import pygame > > Traceback (most recent call last): > > File "<pyshell#0>", line 1, in <module> > > import pygame > > File "C:\Python32\lib\site- > > packages\pygame\__init__.py", line 95, in <module> > > from pygame.base import * > > ImportError: DLL load failed: The specified module could not be found. > > >>> > > > > Pygame support for Python 3 is a bit spotty (AFAIK). It will probably be > easier using an earlier version of Python when working with Pygame. > > HTH, > Wayne > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/tutor/attachments/20110328/4d663213/attachment-0001.html > > > > ------------------------------ > > Message: 2 > Date: Mon, 28 Mar 2011 09:28:18 -0600 > From: Susana Iraiis Delgado Rodriguez <susana.delgad...@utzmg.edu.mx> > To: "Flynn, Stephen (L & P - IT)" <steve.fl...@capita.co.uk> > Cc: tutor@python.org > Subject: Re: [Tutor] Write new line(enter) in txt > Message-ID: > <AANLkTim0MRcDbXYJA=etflkhs9n2s3to-vg_7wbfs...@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > Ok Flyyn! > Thank you for answered my question. I think I didn't explain what I need. > The printing statement is used to print a message to the Windows console, > then the other line written in the else statement is: > log.write('No existe el archivo ' +shx+"\n") > This is the part I'm struggling with, I don't know how to add the "new > line" > to the txt > > 2011/3/28 Flynn, Stephen (L & P - IT) <steve.fl...@capita.co.uk> > > > You don't "print" a newline when you print each line of the file > > contents... > > > > > > print 'El archivo ' +shx +' existe' > > > > > > > > > > > > You need to add a newline: > > > > print 'El archivo ' +shx +' existe' + '\n' > > > > > > > > > > ________________________________________ > > From: tutor-bounces+steve.flynn=capita.co...@python.org [mailto: > > tutor-bounces+steve.flynn=capita.co...@python.org] On Behalf Of Susana > > Iraiis Delgado Rodriguez > > Sent: Monday, March 28, 2011 4:12 PM > > To: tutor@python.org > > Subject: [Tutor] Write new line(enter) in txt > > > > Hello list!! > > > > This is a very simple question!! I want to write some lines in a txt > file, > > but my output looks like this: > > No existe el archivo C:\?ndice.dbfNo existe el archivo > C:\?ndice_dwg.dbfNo > > existe el archivo C:\?ndice_raster.dbf > > I need it to look like this: > > No existe el archivo C:\?ndice.dbf > > No existe el archivo C:\?ndice_dwg.dbf > > No existe el archivo C:\?ndice_raster.dbf > > > > The code I wrote is: > > log = open ('errors.txt','wb') > > shp = 'Error al abrir el archivo' +filepath > > log.write(shp+"\n") > > n = os.path.splitext(filepath) > > p = n[0]+'.prj' > > shx = n[0]+'.shx' > > dbf = n[0]+'.dbf' > > if os.path.exists(shx): > > print 'El archivo ' +shx +' existe' > > else: > > log.write('No existe el archivo ' +shx+"\n") > > if os.path.exists(dbf): > > print 'El archivo ' +dbf +' existe' > > else: > > log.write('No existe el archivo ' +dbf+"\n") > > log.close() > > > > > > This email has been scanned for all viruses by the MessageLabs SkyScan > > service. > > > > This email and any attachment to it are confidential. Unless you are the > > intended recipient, you may not use, copy or disclose either the message > or > > any information contained in the message. If you are not the intended > > recipient, you should delete this email and notify the sender > immediately. > > > > Any views or opinions expressed in this email are those of the sender > only, > > unless otherwise stated. All copyright in any Capita material in this > email > > is reserved. > > > > All emails, incoming and outgoing, may be recorded by Capita and > monitored > > for legitimate business purposes. > > > > Capita exclude all liability for any loss or damage arising or resulting > > from the receipt, use or transmission of this email to the fullest extent > > permitted by law. > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/tutor/attachments/20110328/bc0814df/attachment-0001.html > > > > ------------------------------ > > Message: 3 > Date: Mon, 28 Mar 2011 11:43:25 -0400 > From: Joel Goldstick <joel.goldst...@gmail.com> > To: Susana Iraiis Delgado Rodriguez <susana.delgad...@utzmg.edu.mx> > Cc: tutor@python.org > Subject: Re: [Tutor] Write new line(enter) in txt > Message-ID: > <aanlktik8-iovkmyy_kjr6jspcqwzefqubwah_kbme...@mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > On Mon, Mar 28, 2011 at 11:28 AM, Susana Iraiis Delgado Rodriguez < > susana.delgad...@utzmg.edu.mx> wrote: > > > Ok Flyyn! > > Thank you for answered my question. I think I didn't explain what I need. > > The printing statement is used to print a message to the Windows > console, > > then the other line written in the else statement is: > > > > log.write('No existe el archivo ' +shx+"\n") > > This is the part I'm struggling with, I don't know how to add the "new > > line" to the txt > > > > 2011/3/28 Flynn, Stephen (L & P - IT) <steve.fl...@capita.co.uk> > > > >> You don't "print" a newline when you print each line of the file > >> contents... > >> > >> > >> > >> print 'El archivo ' +shx +' existe' > >> > >> > >> > >> > >> > >> You need to add a newline: > >> > >> print 'El archivo ' +shx +' existe' + '\n' > >> > >> > >> > >> > >> ________________________________________ > >> From: tutor-bounces+steve.flynn=capita.co...@python.org [mailto: > >> tutor-bounces+steve.flynn=capita.co...@python.org] On Behalf Of Susana > >> Iraiis Delgado Rodriguez > >> Sent: Monday, March 28, 2011 4:12 PM > >> To: tutor@python.org > >> Subject: [Tutor] Write new line(enter) in txt > >> > >> > >> Hello list!! > >> > >> This is a very simple question!! I want to write some lines in a txt > file, > >> but my output looks like this: > >> No existe el archivo C:\?ndice.dbfNo existe el archivo > C:\?ndice_dwg.dbfNo > >> existe el archivo C:\?ndice_raster.dbf > >> I need it to look like this: > >> No existe el archivo C:\?ndice.dbf > >> No existe el archivo C:\?ndice_dwg.dbf > >> No existe el archivo C:\?ndice_raster.dbf > >> > >> The code I wrote is: > >> log = open ('errors.txt','wb') > >> > > > > Change the above line to > log = open('errors.txt, 'w') > > You are opening your log file in binary mode, so your operating system > doesn't convert your '\n' to what it needs for new line > > > > shp = 'Error al abrir el archivo' +filepath > >> log.write(shp+"\n") > >> n = os.path.splitext(filepath) > >> p = n[0]+'.prj' > >> shx = n[0]+'.shx' > >> dbf = n[0]+'.dbf' > >> if os.path.exists(shx): > >> print 'El archivo ' +shx +' existe' > >> else: > >> log.write('No existe el archivo ' +shx+"\n") > >> if os.path.exists(dbf): > >> print 'El archivo ' +dbf +' existe' > >> else: > >> log.write('No existe el archivo ' +dbf+"\n") > >> log.close() > >> > >> > >> This email has been scanned for all viruses by the MessageLabs SkyScan > >> service. > >> > >> This email and any attachment to it are confidential. Unless you are > the > >> intended recipient, you may not use, copy or disclose either the message > or > >> any information contained in the message. If you are not the intended > >> recipient, you should delete this email and notify the sender > immediately. > >> > >> Any views or opinions expressed in this email are those of the sender > >> only, unless otherwise stated. All copyright in any Capita material in > this > >> email is reserved. > >> > >> All emails, incoming and outgoing, may be recorded by Capita and > monitored > >> for legitimate business purposes. > >> > >> Capita exclude all liability for any loss or damage arising or resulting > >> from the receipt, use or transmission of this email to the fullest > extent > >> permitted by law. > >> > > > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > To unsubscribe or change subscription options: > > http://mail.python.org/mailman/listinfo/tutor > > > > > > > -- > Joel Goldstick > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/tutor/attachments/20110328/9812ccbb/attachment.html > > > > ------------------------------ > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > > End of Tutor Digest, Vol 85, Issue 103 > ************************************** >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor