Re: file handling issues

2013-09-07 Thread Piet van Oostrum
Leo Carnovale writes: > Ah and one other thing! > What is this crypto algorithm you speak of? I desperately need some sort of > encryption as at the moment anyone can simply open the text file and change > the numbers to numbers that work! > Where can I learn more about it? You can google for

Re: file handling issues

2013-09-06 Thread Leo Carnovale
On Saturday, 7 September 2013 13:58:43 UTC+10, Michael Torrie wrote: > On 09/06/2013 09:05 PM, Leo Carnovale wrote: > > > Ah and one other thing! What is this crypto algorithm you speak of? I > > > desperately need some sort of encryption as at the moment anyone can > > > simply open the text f

Re: file handling issues

2013-09-06 Thread Michael Torrie
On 09/06/2013 09:05 PM, Leo Carnovale wrote: > Ah and one other thing! What is this crypto algorithm you speak of? I > desperately need some sort of encryption as at the moment anyone can > simply open the text file and change the numbers to numbers that > work! Where can I learn more about it? Th

Re: file handling issues

2013-09-06 Thread Leo Carnovale
On Saturday, 7 September 2013 13:03:14 UTC+10, Leo Carnovale wrote: > On Saturday, 7 September 2013 02:17:03 UTC+10, Piet van Oostrum wrote: > > > leo.carnov...@gmail.com writes: > > > > > > > > > > > > > I am making this little game and I am trying to make some sort of script > > > that

Re: file handling issues

2013-09-06 Thread Leo Carnovale
On Saturday, 7 September 2013 02:17:03 UTC+10, Piet van Oostrum wrote: > leo.carnov...@gmail.com writes: > > > > > I am making this little game and I am trying to make some sort of script > > that does the following: > > >>Checks to see if a file exists > > > >If it does, check the numbers

Re: file handling issues

2013-09-06 Thread Piet van Oostrum
leo.carnov...@gmail.com writes: > I am making this little game and I am trying to make some sort of script that > does the following: >>Checks to see if a file exists > >If it does, check the numbers in it > >If it doesn't, make one and fill it with some numbers >>Sorts out if the numbers in th

Re: file handling issues

2013-09-06 Thread leo . carnovale
On Friday, 6 September 2013 20:20:02 UTC+10, leo.ca...@gmail.com wrote: > I am making this little game and I am trying to make some sort of script that > does the following: > > >Checks to see if a file exists > > >If it does, check the numbers in it > > >If it doesn't, make one and fill it

Re: file handling

2010-06-14 Thread Cameron Simpson
Please don't top post; post below and trim the content. Also, please do a reply-to-all to keep the discussion on the list. Further content is below... On 14Jun2010 11:44, madhuri vio wrote: | On Mon, Jun 14, 2010 at 11:39 AM, Cameron Simpson wrote: | > ODT files are _not_ text files. If I recal

Re: file handling

2010-06-13 Thread Cameron Simpson
On 14Jun2010 11:05, madhuri vio wrote: | i have a doubt about ...this..can u look into this.. | | a = open("human.odt","r") | b = a.readlines() | print b | | and i get d output something else... | | python monday.py | ["PK\x03\x04\x14\x00\x00\x00\x00\x00\xd6+\xce<^\xc62\x0c'\x00\x00\x00'\x00\x

Re: file handling

2010-06-13 Thread Benjamin Kaplan
On Sun, Jun 13, 2010 at 10:35 PM, madhuri vio wrote: > i have a doubt about ...this..can u look into this.. > > a = open("human.odt","r") > b = a.readlines() > print b > > and i get d output something else... > > python monday.py > ["PK\x03\x04\x14\x00\x00\x00\x00\x00\xd6+\xce<^\xc62\x0c'\x00\x00\

Re: file handling

2010-06-13 Thread James Mills
On Mon, Jun 14, 2010 at 3:35 PM, madhuri vio wrote: > i have a doubt about ...this..can u look into this.. > > a = open("human.odt","r") > b = a.readlines() > print b > > and i get d output something else... > > python monday.py > ["PK\x03\x04\x14\x00\x00\x00\x00\x00\xd6+\xce<^\xc62\x0c'\x00\x00\x

Re: File Handling Problem

2009-09-06 Thread joy99
On Sep 5, 11:49 am, Chris Rebert wrote: > On Fri, Sep 4, 2009 at 11:39 PM, > SUBHABRATABANERJEE wrote: > > > > > And one small question does Python has any increment operator like ++ in C. > > No. We do  x += 1  instead. > > Cheers, > Chris > --http://blog.rebertia.com Thanx for your kind reply

Re: File Handling Problem

2009-09-04 Thread Chris Rebert
On Fri, Sep 4, 2009 at 11:39 PM, SUBHABRATA BANERJEE wrote: > And one small question does Python has any increment operator like ++ in C. No. We do x += 1 instead. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list

Re: File Handling Problem

2009-09-04 Thread SUBHABRATA BANERJEE
Dear Sir, Thank you for your kind reply. I would surely check your code. Meanwhile, I solved it using readlines() but not in your way. I will definitely have a look in your code. My solution came so smart that I felt I should not have posted this question. But I would like to know about, i) File

Re: File Handling Problem

2009-09-04 Thread Rami Chowdhury
No: readlines () retains the "\n"s; splitlines () loses them Ah, thank you for the clarification! On Fri, 04 Sep 2009 08:39:37 -0700, Tim Golden wrote: Rami Chowdhury wrote: f = open("myfile.txt", "r") list_one = f.read().splitlines() f.close() Or use f.readlines(), which would do the

Re: File Handling Problem

2009-09-04 Thread Tim Golden
Rami Chowdhury wrote: f = open("myfile.txt", "r") list_one = f.read().splitlines() f.close() Or use f.readlines(), which would do the same thing IIRC? No: readlines () retains the "\n"s; splitlines () loses them TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: File Handling Problem

2009-09-04 Thread Rami Chowdhury
f = open("myfile.txt", "r") list_one = f.read().splitlines() f.close() Or use f.readlines(), which would do the same thing IIRC? On Fri, 04 Sep 2009 07:46:42 -0700, Stephen Fairchild wrote: joy99 wrote: Dear Group, I have a file. The file has multiple lines. I want to get the line numb

Re: File Handling Problem

2009-09-04 Thread Lucas Prado Melo
On Fri, Sep 4, 2009 at 9:50 AM, joy99 wrote: > Dear Group, > > I have a file. The file has multiple lines. I want to get the line > number of any one of the strings. > Once I get that I like to increment the line number and see the string > of the immediate next line or any following line as outp

Re: File Handling Problem

2009-09-04 Thread Stephen Fairchild
joy99 wrote: > Dear Group, > > I have a file. The file has multiple lines. I want to get the line > number of any one of the strings. > Once I get that I like to increment the line number and see the string > of the immediate next line or any following line as output. The > problem as I see is ni

Re: File handling problem.

2009-05-03 Thread SUBHABRATA BANERJEE
Dear Sir, Thanx for your prompt reply, I would be trying to work on your suggestion and get back to you as soon as possible. Best Regards, Subhabrata. On Sun, May 3, 2009 at 10:47 PM, Chris Rebert wrote: > On Sun, May 3, 2009 at 9:51 AM, SUBHABRATA BANERJEE > wrote: > > Dear Group, > > > > > >

Re: File handling problem.

2009-05-03 Thread Chris Rebert
On Sun, May 3, 2009 at 9:51 AM, SUBHABRATA BANERJEE wrote: > Dear Group, > > > > I am working on a code like the following: > > > > from decimal import* > > #SAMPLE TEST PROGRAM FOR FILE > > def sample_file_test(n): > >     #FILE FOR STORING PROBABILITY VALUES > >     open_file=open("/python26/New

Re: File handling problem.

2009-05-03 Thread SUBHABRATA BANERJEE
Dear Group, I am working on a code like the following: from decimal import* #SAMPLE TEST PROGRAM FOR FILE def sample_file_test(n): #FILE FOR STORING PROBABILITY VALUES open_file=open("/python26/Newfile1.txt","r+") #OPENING OF ENGLISH CORPUS open_corp_eng=open("/python26/

Re: File handling problem.

2009-05-02 Thread Steven D'Aprano
On Sat, 02 May 2009 01:26:14 -0700, subhakolkata1234 wrote: > Dear Group, > > I am using Python2.6 and has created a file where I like to write some > statistical values I am generating. The statistical values are > generating in a nice way, but as I am going to write it, it is not > taking it, t

Re: File handling problem.

2009-05-02 Thread Pascal Chambon
subhakolkata1...@gmail.com a écrit : Dear Group, I am using Python2.6 and has created a file where I like to write some statistical values I am generating. The statistical values are generating in a nice way, but as I am going to write it, it is not taking it, the file is opening or closing prop

Re: File Handling & TRY/EXCEPT

2007-08-05 Thread Gabriel Genellina
En Fri, 03 Aug 2007 10:38:17 -0300, Robert Rawlins - Think Blue <[EMAIL PROTECTED]> escribió: > Thanks for your ideas guys, > > I'm unfortunately tied to 2.4 so don't have the full try except status, > but > I'm now working with the following code: > > def addApp(self, event): >

RE: File Handling & TRY/EXCEPT

2007-08-03 Thread Alex Popescu
"Robert Rawlins - Think Blue" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Thanks for your ideas guys, > > I'm unfortunately tied to 2.4 so don't have the full try except > status, but I'm now working with the following code: > > def addApp(self, event): > try: >

RE: File Handling & TRY/EXCEPT

2007-08-03 Thread Robert Rawlins - Think Blue
#x27;m a little reluctant about posting all my app code on the lists as I'd like to keep some of it private. How does that new version look? A little tidier? Thanks guys, Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steve Holden Sent: 03 Au

Re: File Handling & TRY/EXCEPT

2007-08-03 Thread Steve Holden
Robert Rawlins - Think Blue wrote: > Hello Guys, > > > > I’m looking for some advice on how best to handle file read/write errors > with try/except as i’m a little vague on this, I have a small memory > leak in my app and I’m starting to think its generated by my log file > write. For an exa

Re: File Handling & TRY/EXCEPT

2007-08-03 Thread Alex Popescu
"Robert Rawlins - Think Blue" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > This is a multipart message in MIME format. > > --=_NextPart_000_00B0_01C7D5B0.02EB8BA0 > Hello Guys, > > > > I'm looking for some advice on how best to handle file read/write > errors with try/except as

Re: file handling in a server (.py) file using xmlrpc

2005-07-08 Thread uwb
Jeremy Jones wrote: >>The script executes, no error messages, but the glob call turns up nothing >>while the identical call running from a console does in fact turn up files >>names as expected. >> >> > Wild guess, but I'm thinking your webserver process doesn't have > permissions to look in you

Re: file handling in a server (.py) file using xmlrpc

2005-07-08 Thread Jeremy Jones
uwb wrote: >Jeremy Jones wrote: > > > >>uwb wrote: >> >> >> >>>I've got a call to glob in a .py file sitting in an apache cgi-bin >>>directory which refuses to work while the exact same code works from a >>>python console session. >>> >>>I'm guessing that in order to read or write files from

Re: file handling in a server (.py) file using xmlrpc

2005-07-08 Thread uwb
Jeremy Jones wrote: > uwb wrote: > >>I've got a call to glob in a .py file sitting in an apache cgi-bin >>directory which refuses to work while the exact same code works from a >>python console session. >> >>I'm guessing that in order to read or write files from any sort of a >>script file sittin

Re: file handling in a server (.py) file using xmlrpc

2005-07-08 Thread Jeremy Jones
uwb wrote: >I've got a call to glob in a .py file sitting in an apache cgi-bin directory >which refuses to work while the exact same code works from a python console >session. > >I'm guessing that in order to read or write files from any sort of a script >file sitting in the cgi-bin directory on a

Re: File Handling Problems Python I/O

2005-01-06 Thread Craig Ringer
On Fri, 2005-01-07 at 02:06, Josh wrote: > Peter, > > Thank you for the rookie correction. That was my exact problem. I > changed the address to use forward slashes and it works perfect. I did > not know that a backslash had special meaning within a string, but now > I do! Thanks again There's an

Re: File Handling Problems Python I/O

2005-01-06 Thread Peter Hansen
Josh wrote: He is the function where I am making the call. If I change the open statment to another file, say "c:\test.txt", a file I know exists, it will error out stating the file does not exist. Thanks def GetStartVars(self): try: DOWNFILE = open("c:\fixes.txt","r") Josh, it's surprising that th

Re: File Handling Problems Python I/O

2005-01-06 Thread Josh
Micheal, Thanks for the advice as the programming I am doing will be run on both Windows and Linux based PC's, that being the main reason for my venture into Python. I'm glad to see that people are willing to help out even the newbie's. Josh -- http://mail.python.org/mailman/listinfo/python-l

Re: File Handling Problems Python I/O

2005-01-06 Thread mhartl
Sorry, the BASE variable should be 'C:\\' on Windows: >>> BASE = 'C:\\' >>> import os >>> os.path.join(BASE, 'foo', 'bar', 'baz') 'C:\\foo\\bar\\baz' -- http://mail.python.org/mailman/listinfo/python-list

Re: File Handling Problems Python I/O

2005-01-06 Thread mhartl
You can use the os module to build path names in a platform-independent manner. On my Linux box, I can type >>> BASE = '/' >>> import os >>> os.path.join(BASE, 'foo', 'bar', 'baz') '/foo/bar/baz' On a Windows machine, you get >>> BASE = 'C:' >>> import os >>> os.path.join(BASE, 'foo', 'bar', 'b

Re: File Handling Problems Python I/O

2005-01-06 Thread Alex Martelli
Josh <[EMAIL PROTECTED]> wrote: ... > He is the function where I am making the call. If I change the open > statment to another file, say "c:\test.txt", a file I know exists, it Are you sure a file exist whose name is, c, colon, tab, e, s, t ...? \t is an escape sequence and it means TAB (char

Re: File Handling Problems Python I/O

2005-01-06 Thread deelan
Josh wrote: Peter, Thank you for the rookie correction. That was my exact problem. I changed the address to use forward slashes and it works perfect. I did not know that a backslash had special meaning within a string, but now I do! Thanks again you may want to check "python gotchas" to avoid other

Re: File Handling Problems Python I/O

2005-01-06 Thread Josh
Peter, Thank you for the rookie correction. That was my exact problem. I changed the address to use forward slashes and it works perfect. I did not know that a backslash had special meaning within a string, but now I do! Thanks again Josh -- http://mail.python.org/mailman/listinfo/python-list

Re: File Handling Problems Python I/O

2005-01-06 Thread Josh
He is the function where I am making the call. If I change the open statment to another file, say "c:\test.txt", a file I know exists, it will error out stating the file does not exist. Thanks Josh def GetStartVars(self): try: DOWNFILE = open("c:\fixes.txt","r") except IOError: print "Failed to o

Re: File Handling Problems Python I/O

2005-01-06 Thread Peter Hansen
Josh wrote: I am having a problem with Python. I am new to Python as a programming language, but I do have experience in other languages. I am experiencing strange problems with File handling and wonder if anyone else has seen this or knows what I am doing wrong. I am simply trying to open a file f

Re: File Handling Problems Python I/O

2005-01-06 Thread Arjen Dijkstra
I don't think we can help if you don't post some of your code. Regards, Arjen Josh wrote: Hi, I am having a problem with Python. I am new to Python as a programming language, but I do have experience in other languages. I am experiencing strange problems with File handling and wonder if anyone else

RE: File Handling Problems Python I/O

2005-01-06 Thread Batista, Facundo
Title: RE: File Handling Problems Python I/O [Josh] #- able to do so without a problem, but here's the catch: The open #- statement is only working on certain files. I open a simple text file #- say file1.txt without any issues, but I change the open statement to #- another text file a