On 15/02/2012 20:12, Rituparna Sengupta wrote:
Hi,
I'm working on this code and I keep getting an error. It might be some very
basic thing but I was wondering if someone could help. Its a loop within a
loop. The part outside the innermost loop gets printed fine, but the part
within the innerm
On 02/15/2012 03:12 PM, Rituparna Sengupta wrote:
Hi,
I'm working on this code and I keep getting an error. It might be some very
basic thing but I was wondering if someone could help. Its a loop within a
loop. The part outside the innermost loop gets printed fine, but the part
within the inn
On Wed, Feb 15, 2012 at 12:12 PM, Rituparna Sengupta wrote:
> Hi,
>
> I'm working on this code and I keep getting an error. It might be some very
> basic thing but I was wondering if someone could help. Its a loop within a
> loop. The part outside the innermost loop gets printed fine, but the pa
On Wed, Feb 15, 2012 at 1:12 PM, Rituparna Sengupta wrote:
> Hi,
>
> I'm working on this code and I keep getting an error. It might be some very
> basic thing but I was wondering if someone could help. Its a loop within a
> loop. The part outside the innermost loop gets printed fine, but the par
I appreciate you all taking the time to answer my question.
These were the types of things I was needing to hear.
Sorry for any confusion I may have caused by using a
relative file path with the '~'… I was typing from
memory and didn't think about it beforehand.
Eryksun, thank you for the in
On Sat, 26 Mar 2011 14:49:31 +1300, Gregory Ewing wrote:
> jyoun...@kc.rr.com wrote:
>
>import os
>os.system('echo "Testing a... b... c..." > "~/Desktop/test2.txt"')
>
> This is like going out the back door, getting a ladder out of the shed
> and climbing through your bedroom window to g
On Fri, 25 Mar 2011 19:39:11 -0600, Littlefield, Tyler wrote:
> >with open(test_absname, 'w') as test:
> what's the difference in that and test = ...? I can see why you mentioned
> the os.path for cross-platform, but I don't understand why someone would
> use with over =.
Using "with" will a
On Friday, March 25, 2011 9:39:11 PM UTC-4, Littlefield, Tyler wrote:
> >with open(test_absname, 'w') as test:
> what's the difference in that and test = ...? I can see why you
> mentioned the os.path for cross-platform, but I don't understand why
> someone would use with over =.
It avoids h
with closes the file for you, when the indented block is exited.
~ isn't cross-platform at all, in fact it's not precisely python, though
os.path.expanduser understands it.
AFAIK, the jury's still out on whether the /'s in pathnames as directory
separators are portable. I know they work on *ix a
jyoun...@kc.rr.com wrote:
import os
os.system('echo "Testing a... b... c..." > "~/Desktop/test2.txt"')
This is like going out the back door, getting a ladder out of
the shed and climbing through your bedroom window to get into
bed at night, instead of just using the stairs.
Use open/write/clo
John Gordon wrote:
The write() way is much better. (However, I'm not sure it will do what
you were expecting with the tilde in the file path.)
It won't, but the os.path.expanduser() function can
be used to fix that.
--
Greg
--
http://mail.python.org/mailman/listinfo/python-list
>with open(test_absname, 'w') as test:
what's the difference in that and test = ...? I can see why you
mentioned the os.path for cross-platform, but I don't understand why
someone would use with over =.
On 3/25/2011 7:11 PM, eryksun () wrote:
On Friday, March 25, 2011 11:07:19 AM UTC-4, jy
On Friday, March 25, 2011 11:07:19 AM UTC-4, jyou...@kc.rr.com wrote:
>
> >>> f = open('~/Desktop/test.txt', 'w')
> >>> f.write('testing 1... 2... 3...')
> >>> f.close()
Consider using "with" to automatically close the file and os.path for
cross-platform compatibility:
import os.path
use
On Fri, 2011-03-25 at 15:07 +, jyoun...@kc.rr.com wrote:
> Just curious how others view the 2 examples below for creating and
> writing to a file in Python (in OS X). Is one way better than the other?
> If it was a large amount of text, would the 'os.system' call be a bad
> way to do it?
In
writes:
> Just curious how others view the 2 examples below for creating and
> writing to a file in Python (in OS X). Is one way better than the other?
> If it was a large amount of text, would the 'os.system' call be a bad
> way to do it?
The write() way is much better. (However, I'm
On Mar 25, 8:07 am, wrote:
> Just curious how others view the 2 examples below for creating and
> writing to a file in Python (in OS X). Is one way better than the other?
> If it was a large amount of text, would the 'os.system' call be a bad
> way to do it?
>
> Thanks.
>
> Jay
>
>
>
> >>> f =
On May 30, 4:53 pm, sturlamolden <[EMAIL PROTECTED]> wrote:
> However, numpy has a properly working memory mapped array class,
> numpy.memmap.
It seems that NumPy's memmap uses a buffer from mmap, which makes both
of them defunct for large files. Damn.
mmap must be fixed.
--
http://mail.p
On May 30, 4:53 pm, sturlamolden <[EMAIL PROTECTED]> wrote:
> import numpy
>
> byte = numpy.uint8
> desc = numpy.dtype({'names':['r','g','b'],'formats':[byte,byte,byte]})
> mm = numpy.memmap('myfile.dat', dtype=desc, offset=4096,
> shape=(480,640), order='C')
> red = mm['r']
> green = mm['g']
> bl
On May 30, 1:41 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] schrieb:
> > what i want to know is which one is faster (if there is any difference
> > in speed) since i'm working with very large files. of course, if there
> > is any other way to write data to a file, i'd lov
[EMAIL PROTECTED] schrieb:
> as i understand there are two ways to write data to a file: using
> f.write("foo") and print >>f, "foo".
> what i want to know is which one is faster (if there is any difference
> in speed) since i'm working with very large files. of course, if there
> is any other way
[EMAIL PROTECTED] wrote:
> as i understand there are two ways to write data to a file: using
> f.write("foo") and print >>f, "foo".
well print will add a '\n' or ' ' if you use ',' after it
> what i want to know is which one is faster (if there is any difference
there shouldn't be any noticable d
21 matches
Mail list logo