-- Forwarded message --
Date: Mon, 25 Sep 2006 16:46:02 -0600
From: max . <[EMAIL PROTECTED]>
To: Danny Yoo <[EMAIL PROTECTED]>
Subject: Re: [Tutor] opening files
ok srry i will give a bit more info
i am working on a new mac mini :))
im still pretty new to python so allmost all
> my_file = open('c:\\path\to\file\file.txt', 'r')
> my_file.readlines()
> my_file.close()
>
> Really, it's so simple it's hard to come up with directions.
Hi John,
In that case, we have to figure out why Max is getting stuck: it's not
obvious at all at what step he's getting confused. Let's co
On Mon, 25 Sep 2006, max . wrote:
> hello i cant understand how to open text files with python
> i have tried tutorials and evrything i just cant get pleas help
Hi Max,
Which tutorials are you trying? Have you looked at:
http://www.freenetpages.co.uk/hp/alan.gauld/
There's a whole sect
On Mon, 2006-09-25 at 12:55 -0600, max . wrote:
> hello i cant understand how to open text files with python
> i have tried tutorials and evrything i just cant get pleas help
> ___
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/lis
hello i cant understand how to open text files with python
i have tried tutorials and evrything i just cant get pleas help
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
At 10:40 AM 9/25/2006, you wrote:
>Dick Moores wrote:
> > Damn. Thanks, Kent. I was hoping you'd pooh-pooh the advice.
>
>I don't really know anything about it other than what I read on the
>psyco site, but they should know whether it works or not...there *was* a
>change in the __index__ method for
Dick Moores wrote:
> Damn. Thanks, Kent. I was hoping you'd pooh-pooh the advice.
I don't really know anything about it other than what I read on the
psyco site, but they should know whether it works or not...there *was* a
change in the __index__ method for 2.5rc1, it is listed here:
http://www.
At 09:46 AM 9/25/2006, Kent Johnson wrote:
>Dick Moores wrote:
> > I installed Python 2.5 yesterday and now want to get psyco for it. At
> > http://psyco.sourceforge.net/ there's an item dated 9/25 (today) that
> > I'm wondering if the Tutors think is necessary to follow. It would be
> > much easie
At 09:04 AM 9/25/2006, Carroll, Barry wrote:
>Hello, Dick.
>
>Let's compare your final startswith method and the endswith method in
>is_image_file:
>
> >>>
>s.startswith("er","q","ty")
>filename.endswith(('.gif', '.jpg', '.tiff'))
> >>>
>
>Notice that, while startswith has THREE parameters
Dick Moores wrote:
> I installed Python 2.5 yesterday and now want to get psyco for it. At
> http://psyco.sourceforge.net/ there's an item dated 9/25 (today) that
> I'm wondering if the Tutors think is necessary to follow. It would be
> much easier for me to get Psyco 1.5.1 from
> http://source
I installed Python 2.5 yesterday and now want to get psyco for it. At
http://psyco.sourceforge.net/ there's an item dated 9/25 (today) that
I'm wondering if the Tutors think is necessary to follow. It would be
much easier for me to get Psyco 1.5.1 from
http://sourceforge.net/project/showfiles.p
> -Original Message-
> Date: Mon, 25 Sep 2006 02:59:45 -0700
> From: Dick Moores <[EMAIL PROTECTED]>
> Subject: [Tutor] Question about startswith() and endswith() in 2.5
> To: tutor@python.org
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset="us-ascii"; format=flowed
>
Thanks, Kent and Andrei! I sure did miss those doubled parentheses.
>>> s = "qwerty"
>>>
>>> s.startswith(("er","z","ty","qw","98768976","uytruytr"))
True
>>> s.startswith(("er","z","ty","qe","98768976","uytruytr"))
False
>>> s.startswith(("er","z","rty","qe","98768976","uytruytr"), 2)
True
Wesley Brooks gmail.com> writes:
> Most of these are issues relating to a mix of speed of execution
> for the code, and scripting best practice.
Generally speaking, performance bottlenecks can be determined using the profile
module. Things often turn out different than you might expect, so talk
Wesley Brooks wrote:
> Firstly tuples vs lists. I'm guessing that lists use more memory than
> tuples as they provide more functions? Are they also more CPU intensive
> to use?
First the requisite caveats about optimization:
1. Don't optimize until you have a demonstrated performance problem.
2
Dick Moores rcblue.com> writes:
> endswith( suffix[, start[, end]])
> Return True if the string ends with the specified suffix, otherwise
> return False. suffix can also be a tuple of suffixes to look for.
> >>> s.startswith("er","q","ty")
>
> Traceback (most recent call last):
>File "",
Dick Moores wrote:
> >>> s.startswith("er","q","ty")
>
> Traceback (most recent call last):
>File "", line 1, in
> s.startswith("er","q","ty")
> TypeError: slice indices must be integers or None or have an __index__ method
>
> On http://docs.python.org/whatsnew/other-lang.html I found
http://www.python.org/doc/lib/string-methods.html has
=
startswith( prefix[, start[, end]])
Return True if string starts with the prefix, otherwise return False.
prefix can also be a tuple of suffixes to look for. With optional
start, test string beginn
Dear Python-Tutor members,I'm currently in the middle of re-writing a program for my research. I've been using python for the past three years now, my first language since a brief exposure to qbasic ten years ago. There are a couple of things I'm not sure about which I'll need to clear up before I
19 matches
Mail list logo