Hi All,
I have reserved an area at the Schoolhouse Pub for 9:30pm, so if people want
to meetup after the talks, we can disperse there. (Just look for area
reserved for Python Ireland).
More details on the wiki.
See you all there!
/// Vicky
On 7/17/07, Vicky Lee [EMAIL PROTECTED] wrote:
Hi
Find a new release of python-ldap:
http://python-ldap.sourceforge.net/
python-ldap provides an object-oriented API to access LDAP directory
servers from Python programs. It mainly wraps the OpenLDAP 2.x libs for
that purpose. Additionally it contains modules for other LDAP-related
stuff (e.g.
En Wed, 25 Jul 2007 00:02:51 -0300, Gordon Airporte [EMAIL PROTECTED]
escribió:
Gabriel Genellina wrote:
As is often the case, a regular expression is NOT the right tool to use
in this case.
Very interesting, thank you. I think 'pattern matching' and I
automatically think 'regular
Hi ALL
I have SLES 10 installed on my machine, i wanted to get all the information
about the installed USER authentication modules
for example :: localauthentication or LDAP or even a radius server
how can I get the above information in SUSE, do we have any python scripts
for that
Thanks in
En Tue, 24 Jul 2007 21:55:17 -0300, Alex Popescu
[EMAIL PROTECTED] escribió:
Neil Cerutti [EMAIL PROTECTED] wrote in news:eRwpi.36813$G23.28496
@newsreading01.news.tds.net:
On 2007-07-25, Alex Popescu [EMAIL PROTECTED] wrote:
As a matter of style, how do you figure out that class_list is
a
Aahz a écrit :
(snip)
*YOU* are the one confusing people by your dogmatic insistance that
classic classes should be ignored. Grow up.
I did. I still do. With every new Python release. I'm sorry for you that
you are still stuck with almost prehistoric Python versions, but I don't
accept
Dear fellows,
I'm trying to create a executable file using py2exe . Unfortunately
along with the python executable file it also creates some other files
that are needed in order to the executable be able to run in a system
that doesn't have Python installed. Can some one guide me on how can I
james_027 wrote:
hi bruno,
That seems to be hard to read at all, or I am just very new to python?
No, it's hard to read. Note that it's not, technically, necessary to
use nested functions to get the same results as a particular decorator.
For example, earlier you provided...
def
Gordon Airporte [EMAIL PROTECTED] writes:
I did already find that it speeds things up to pre-test a line like
if 'bets' or 'calls' or 'raises' in line:
run the appropriate re's
which isn't very pretty at all
Nor does it work the way you might suppose:
line = foo calls
if
On Jul 25, 12:28 pm, Asun Friere [EMAIL PROTECTED] wrote:
On Jul 25, 8:51 am, Boris Dušek [EMAIL PROTECTED] wrote:
In Python, I found that file objects exist. While specifying
argument types in Python is not possible as in Java, it is possible to
check whether an object is an instance of
Alex Popescu a écrit :
Bruno Desthuilliers [EMAIL PROTECTED] wrote
in news:[EMAIL PROTECTED]:
[snip...]
Not necessarily - you can access class attributes from within an
instance method (but obviously a classmethod cannot access instance
attributes).
What I am doing wrong here
On Jul 25, 2:34 am, NicolasG [EMAIL PROTECTED] wrote:
Dear fellows,
I'm trying to create a executable file using py2exe . Unfortunately
along with the python executable file it also creates some other files
that are needed in order to the executable be able to run in a system
that doesn't
On Jul 25, 1:08 am, Steven D'Aprano
[EMAIL PROTECTED] wrote:
Underscores in numerics are UGLY. Why not take a leaf out of implicit
string concatenation and allow numeric literals to implicitly concatenate?
Python already does:
hello- world = hello-world
Propose:
123 456 789 = 123456789
Hi,
I write the following script to retrieve a part of a large file
from a FTP site:
import ftplib
class ftp_getter(object):
def __init__(self):
self.handle = ftplib.FTP('ftp_server_address')
self.handle.set_debuglevel(2)
self.login()
def login(self):
Sounds like a job for dateutil (http://labix.org/python-dateutil).
It's not a built in module (it's in the cheeseshop at least), but it
looks like it pretty much does exactly what you want. If you really
dont want to download anything, I suppose you could create something
from datetime's
Hi
I want a simple way to interactively remote debug a running python
script which has no tty terminal attached to it. The scripts are
running standalone (i.e. they are automatically started and have no
terminal) and very infrequently come into error conditions which i
want to understand and
On Jul 25, 9:10 am, hong2221 [EMAIL PROTECTED] wrote:
On Jul 25, 2:34 am, NicolasG [EMAIL PROTECTED] wrote:
Dear fellows,
I'm trying to create a executable file using py2exe . Unfortunately
along with the python executable file it also creates some other files
that are needed in order
On 25 srp, 01:07, Ben Finney [EMAIL PROTECTED]
wrote:
Steve Holden [EMAIL PROTECTED] writes:
[EMAIL PROTECTED] wrote:
On 24 srp, 05:20, Gabriel Genellina [EMAIL PROTECTED] wrote:
En Mon, 23 Jul 2007 16:53:01 -0300, ...:::JA:::...
[EMAIL PROTECTED] escribió:
So..how can I do
On Jul 25, 8:34 am, NicolasG [EMAIL PROTECTED] wrote:
Dear fellows,
I'm trying to create a executable file using py2exe . Unfortunately
along with the python executable file it also creates some other files
that are needed in order to the executable be able to run in a system
that doesn't
On Jul 25, 6:19 am, Graeme Glass [EMAIL PROTECTED] wrote:
On Jul 25, 8:34 am, NicolasG [EMAIL PROTECTED] wrote:
Dear fellows,
I'm trying to create a executable file using py2exe . Unfortunately
along with the python executable file it also creates some other files
that are needed in
John's method works perfectly, thanks all for your kind help.
John Machin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
On Jul 24, 8:31 pm, Yinghe Chen [EMAIL PROTECTED] wrote:
Hi,
Could someone help on how to use python to output the next month string
like
this?
AUG07,
vasudevram a écrit :
Bruno Desthuilliers wrote:
s/some/great/g
Both Ruby and Python are known for this.
Thanks for the info.
This is not exactly a scoop, you know ?-)
I'd say that - wrt/ advanced programming tricks - *most* of what you
can do with one can be done with the other -
Hi,
I'm working on documenting wrapped C++ methods.
The thing is that I'd like to add docstrings to a method, but python
won't allow me to:
TypeError: attribute '__doc__' of 'instancemethod' objects is not
writable
What would be an easy way to do so? I'd like to overload the .__doc__,
rather
On 2007-07-25, Alex Popescu [EMAIL PROTECTED] wrote:
Neil Cerutti [EMAIL PROTECTED] wrote in news:eRwpi.36813$G23.28496
@newsreading01.news.tds.net:
On 2007-07-25, Alex Popescu [EMAIL PROTECTED] wrote:
As a matter of style, how do you figure out that class_list is
a class attribute and not
On Jul 25, 7:34 am, NicolasG [EMAIL PROTECTED] wrote:
Dear fellows,
I'm trying to create a executable file using py2exe . Unfortunately
along with the python executable file it also creates some other files
that are needed in order to the executable be able to run in a system
that doesn't
This has me a bit stumped...
I'm trying to extract pictures from a file. So far I'm successfully
retrieved the header and what I think is the colour for each pixel.
Here's the description:
3) The picture data format:
The color information is 15 bit data stored in 16 bit. This means the
most
On Jul 13, 2:44 pm, Steve Holden [EMAIL PROTECTED] wrote:
Thomas Heller wrote:
[EMAIL PROTECTED] schrieb:=
...Do the NT file systems support [renaming an open file] (which I think is
standard for POSIX systems)?
Yes, you can do that. We implemented something like this to replace
dlls
On 25 Lug, 09:48, [EMAIL PROTECTED] wrote:
Hi,
I write the following script to retrieve a part of a large file
from a FTP site:
import ftplib
class ftp_getter(object):
def __init__(self):
self.handle = ftplib.FTP('ftp_server_address')
On Jul 25, 9:53 pm, beertje [EMAIL PROTECTED] wrote:
This has me a bit stumped...
I'm trying to extract pictures from a file. So far I'm successfully
retrieved the header and what I think is the colour for each pixel.
Here's the description:
3) The picture data format:
The color
beertje wrote:
This has me a bit stumped...
I'm trying to extract pictures from a file. So far I'm successfully
retrieved the header and what I think is the colour for each pixel.
Here's the description:
3) The picture data format:
The color information is 15 bit data stored in 16
On Jul 25, 6:38 am, Ali [EMAIL PROTECTED] wrote:
On Jul 25, 7:34 am, NicolasG [EMAIL PROTECTED] wrote:
Dear fellows,
I'm trying to create a executable file using py2exe . Unfortunately
along with the python executable file it also creates some other files
that are needed in order to the
Hendrik van Rooyen ha scritto:
But more seriously - is there any need for a simple serialiser that will
be able to be used to transfer a subset of the built in types over an
open network in a safe manner, for the transfer of things like lists of
parameters?
Yes, there seems to be a need for
Hi there.
I'm setting up test suite for a project of mine.
From test suite, acting as a client, I'd like to know, in certain
situations, if the socket is closed on the other end or not.
I noticed that I can detect such state if a call to socket.read()
returns 0 but it seems a little poor to me.
In article [EMAIL PROTECTED],
billiejoex [EMAIL PROTECTED] wrote:
Hi there.
I'm setting up test suite for a project of mine.
From test suite, acting as a client, I'd like to know, in certain
situations, if the socket is closed on the other end or not.
I noticed that I can detect such state
You can create a lexical closure using a Python generator function,
which allows iteration using a block of code while maintaining
internal state. A generator is a regular function which uses yield
(like Ruby) to define the point at which the function should return an
expression to the calling
Roy Smith wrote:
In article [EMAIL PROTECTED],
billiejoex [EMAIL PROTECTED] wrote:
Hi there.
I'm setting up test suite for a project of mine.
From test suite, acting as a client, I'd like to know, in certain
situations, if the socket is closed on the other end or not.
I noticed that I
Is there such a course?
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 25, 9:50 am, beginner [EMAIL PROTECTED] wrote:
Hi,
I am wondering how do I 'flatten' a list or a tuple? For example, I'd
like to transform[1, 2, (3,4)] or [1,2,[3,4]] to [1,2,3,4].
Another question is how do I pass a tuple or list of all the
aurgements of a function to the function.
On 25 Lug, 16:37, Roy Smith [EMAIL PROTECTED] wrote:
This isn't really a Python question, it's a Berkeley Socket API question.
You don't say, but I assume you're talking about a TCP (i.e. SOCKSTREAM)
connection?
Yes.
The answer is you can use the select() system call to detect exceptional
Hi,
I am wondering how do I 'flatten' a list or a tuple? For example, I'd
like to transform[1, 2, (3,4)] or [1,2,[3,4]] to [1,2,3,4].
Another question is how do I pass a tuple or list of all the
aurgements of a function to the function. For example, I have all the
arguments of a function in a
Steven D'Aprano wrote:
Python already does:
hello- world = hello-world
Propose:
123 456 789 = 123456789
123.456 789 = 123.456789
I second that!
/W
--
http://mail.python.org/mailman/listinfo/python-list
Find a new release of python-ldap:
http://python-ldap.sourceforge.net/
python-ldap provides an object-oriented API to access LDAP directory
servers from Python programs. It mainly wraps the OpenLDAP 2.x libs for
that purpose. Additionally it contains modules for other LDAP-related
stuff (e.g.
In article [EMAIL PROTECTED],
Jason [EMAIL PROTECTED] wrote:
.
[good detail]
.
.
If you can't find a way of doing what you want with iterators,
comprehensions, or lambda, consider writing a little function.
On Wed, 25 Jul 2007 14:50:18 +, beginner wrote:
Hi,
I am wondering how do I 'flatten' a list or a tuple? For example, I'd
like to transform[1, 2, (3,4)] or [1,2,[3,4]] to [1,2,3,4].
A recursive function, always yielding the first element of the list,
could do the job. See the ASPN
Hello,
I have a situation where I have a file that contains text similar to:
myValue1 = contents of value1
myValue2 = contents of value2 but
with a new line here
myValue3 = contents of value3
My first approach was to open the file, use readlines to split the
lines on the
Hi Everyone,
http://surkumarm.googlepages.com/home
I found a cool Websites which can be a great resource to making easy
money for Home Moms, kids, Students and other people who are looking
for making some easy Money Online.
This website talks about programmes launched by Giant companies like
On Jul 25, 10:19 am, Stargaming [EMAIL PROTECTED] wrote:
On Wed, 25 Jul 2007 14:50:18 +, beginner wrote:
Hi,
I am wondering how do I 'flatten' a list or a tuple? For example, I'd
like to transform[1, 2, (3,4)] or [1,2,[3,4]] to [1,2,3,4].
A recursive function, always yielding the
On Jul 25, 10:46 am, beginner [EMAIL PROTECTED] wrote:
On Jul 25, 10:19 am, Stargaming [EMAIL PROTECTED] wrote:
On Wed, 25 Jul 2007 14:50:18 +, beginner wrote:
Hi,
I am wondering how do I 'flatten' a list or a tuple? For example, I'd
like to transform[1, 2, (3,4)] or
On Jul 25, 11:00 am, [EMAIL PROTECTED] wrote:
On Jul 25, 10:46 am, beginner [EMAIL PROTECTED] wrote:
On Jul 25, 10:19 am, Stargaming [EMAIL PROTECTED] wrote:
On Wed, 25 Jul 2007 14:50:18 +, beginner wrote:
Hi,
I am wondering how do I 'flatten' a list or a tuple? For
[EMAIL PROTECTED] wrote:
And while we're on the topic of communication: The original poster
would do well to learn that increasing the number of consecutive
punctuation marks (!!!, ???) is a sure way to turn away many people
who would otherwise be helpful. Sentences need at most one '!' or
Diez B. Roggisch wrote:
beertje wrote:
This has me a bit stumped...
I'm trying to extract pictures from a file. So far I'm successfully
retrieved the header and what I think is the colour for each pixel.
Here's the description:
3) The picture data format:
The color information is 15
Jeff wrote:
# Generic counter
def counter(min=None, max):
if not min:
min = 0
for i in xrange(min, max):
yield i
i = i + 1
Just for the record:
# Generic counter
... def counter(min=None, max):
... if not min:
... min = 0
... for i in xrange(min, max):
...
On Jul 25, 10:46 am, [EMAIL PROTECTED] wrote:
Hello,
I have a situation where I have a file that contains text similar to:
myValue1 = contents of value1
myValue2 = contents of value2 but
with a new line here
myValue3 = contents of value3
My first approach was to
beginner wrote:
On Jul 25, 10:19 am, Stargaming [EMAIL PROTECTED] wrote:
On Wed, 25 Jul 2007 14:50:18 +, beginner wrote:
Hi,
I am wondering how do I 'flatten' a list or a tuple? For example, I'd
like to transform[1, 2, (3,4)] or [1,2,[3,4]] to [1,2,3,4].
A recursive function,
On Wed, 25 Jul 2007 15:46:58 +, beginner wrote:
On Jul 25, 10:19 am, Stargaming [EMAIL PROTECTED] wrote:
On Wed, 25 Jul 2007 14:50:18 +, beginner wrote:
[snip]
Another question is how do I pass a tuple or list of all the
aurgements of a function to the function. For example, I have
I've been trying to use wxGlade recently and I am finding it something
of a challenge. Is there any user who finds the user interface
satisfactory and the operation of the program predictable?
If so I would love to hear from you.
regards
Steve
--
Steve Holden+1 571 484 6266 +1 800
So if I understood correctly the recursive structure isn't a problem
for python because a contains a reference to a, not a itself. On
the other hand, print works ok because it has a special trap to detect
recursive structures. I think I understand it now.
Thnks for your replies, miz.
--
Diez B. Roggisch wrote:
beertje wrote:
This has me a bit stumped...
I'm trying to extract pictures from a file. So far I'm successfully
retrieved the header and what I think is the colour for each pixel.
Here's the description:
3) The picture data format:
The color information is 15
beginner [EMAIL PROTECTED] writes:
I know the * operator. However, a 'partial unpack' does not seem to work.
A few other posters have mentioned ways around this, but you might ask
yourself what coding situation makes you want to do this stuff in the
first place. I won't say there's never a
beginner wrote:
On Jul 25, 10:19 am, Stargaming [EMAIL PROTECTED] wrote:
On Wed, 25 Jul 2007 14:50:18 +, beginner wrote:
Hi,
I am wondering how do I 'flatten' a list or a tuple? For example, I'd
like to transform[1, 2, (3,4)] or [1,2,[3,4]] to [1,2,3,4].
A recursive function, always
[EMAIL PROTECTED] wrote:
On Jul 25, 9:50 am, beginner [EMAIL PROTECTED] wrote:
Another question is how do I pass a tuple or list of all the
aurgements of a function to the function. For example, I have all the
arguments of a function in a tuple a=(1,2,3). Then I want to pass each
item in
On Jul 24, 6:51 pm, Boris Dušek [EMAIL PROTECTED] wrote:
Hello,
(sorry to begin with Java in a Python list ;-)
in Java, when I want to pass input to a function, I pass
InputStream, which is a base class of any input stream.
In Python, I found that file objects exist. While specifying
On Jul 25, 8:46 am, beginner [EMAIL PROTECTED] wrote:
On Jul 25, 10:19 am, Stargaming [EMAIL PROTECTED] wrote:
On Wed, 25 Jul 2007 14:50:18 +, beginner wrote:
Hi,
I am wondering how do I 'flatten' a list or a tuple? For example, I'd
like to transform[1, 2, (3,4)] or [1,2,[3,4]]
On Wed, 25 Jul 2007 09:16:26 -0700, kyosohma wrote:
On Jul 25, 10:46 am, [EMAIL PROTECTED] wrote:
Hello,
I have a situation where I have a file that contains text similar to:
myValue1 = contents of value1
myValue2 = contents of value2 but
with a new line here
NicolasG wrote:
Dear fellows,
I'm trying to create a executable file using py2exe . Unfortunately
along with the python executable file it also creates some other files
that are needed in order to the executable be able to run in a system
that doesn't have Python installed. Can some one
On Jul 24, 6:08 pm, Steven D'Aprano
[EMAIL PROTECTED] wrote:
On Tue, 24 Jul 2007 20:09:00 +0200, Bjoern Schliessmann wrote:
Stargaming wrote:
On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote:
While in a syntax like:
for i in xrange(1_000_000):
my eyes help me group them at
On Jul 25, 1:22 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
So, spaces will no longer be delimiters? Won't that cause
much wailing and gnashing of teeth?
I can't think of a circumstance in which
48 1906
is valid, so . . .
I like it, too :)
--
Star Weaver
--
True, and I should have known better than to not have thoroughly
tested code I post to Usenet :). That being said, it was intended as
a fast example of how a generator operates for someone coming from
Ruby.
--
http://mail.python.org/mailman/listinfo/python-list
On 2007-07-25, Jeff [EMAIL PROTECTED] wrote:
Here's a quick flatten() function:
def flatten(obj):
if type(obj) not in (list, tuple, str):
raise TypeError(String, list, or tuple expected in
flatten().)
if len(obj) == 1:
if type(obj[0]) in (tuple, list):
On Wed, 2007-07-25 at 11:58 -0700, [EMAIL PROTECTED] wrote:
You can use the built-in dir() function to determine whether or not
the __iter__ method exists:
class Iterable(object):
def __iter__(self):
pass
class NotIterable(object):
pass
def is_iterable(thing):
On Wed, 25 Jul 2007 11:58:40 -0700, [EMAIL PROTECTED] wrote:
You can use the built-in dir() function to determine whether or not
the __iter__ method exists:
Doesn't work:
In [58]: is_iterable('hello')
Out[58]: False
But strings *are* iterable.
And just calling `iter()` doesn't work either:
On Jul 25, 3:05 pm, Eduardo \EdCrypt\ O. Padoan
[EMAIL PROTECTED] wrote:
def flatten(listOfLists):
return list(chain(*listOfLists))
Fromhttp://www.python.org/doc/2.4/lib/itertools-recipes.html
--
EduardoOPadoan (eopadoan-altavix::com)
Bookmarks:http://del.icio.us/edcrypt
That doesn't
On Wed, Jul 25, 2007 at 12:34:08PM -0700, walterbyrd wrote:
When I posted Python I meant the Python web-developement world. In
particular, python frameworks, like CherryPy, have requirements that
are not realistic for most shared hosting plans.
It's true that the requirements are higher than
On 2007-07-25, Carsten Haese [EMAIL PROTECTED] wrote:
On Wed, 2007-07-25 at 19:26 +, Neil Cerutti wrote:
Speaking of the iter builtin function, is there an example of the
use of the optional sentinel object somewhere I could see?
Example 1: If you use a DB-API module that doesn't support
Python is a better language, with php support, anyway, but I am fed up
with attitudes of comp.lang.perl.misc. Assholes in this newsgroup ruin
Perl experience for everyone. Instead of being helpful, snide remarks,
back-biting, scare tactings, and so on proliferate and self
reinforce. All honest
On 2007-07-25, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:
So there's no reliable way to test for iterables other than
actually iterate over the object.
A TypeError exception is perhaps too generic for comfort in this
use case:
def deeply_mapped(func, iterable):
for item in iterable:
On Wed, 25 Jul 2007 15:46:14 -0400, Carsten Haese wrote:
On Wed, 2007-07-25 at 19:11 +, Marc 'BlackJack' Rintsch wrote:
And just calling `iter()` doesn't work either:
In [72]: class A:
: def __getitem__(self, key):
: if key == 42:
: return
[EMAIL PROTECTED] wrote:
Python is a better language, with php support, anyway, but I am fed up
with attitudes of comp.lang.perl.misc. Assholes in this newsgroup ruin
Perl experience for everyone. Instead of being helpful, snide remarks,
back-biting, scare tactings, and so on proliferate and
Grant Edwards wrote:
On 2007-07-25, Jeff McNeil [EMAIL PROTECTED] wrote:
Depending on the size of your file, you can just use
file.readlines. Note that file.readlines is going to read the
entire file into memory, so don't use it on your plain-text
version of War and Peace.
I don't think
_
[EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote on VLXXVI September
MCMXCIII in URL:news:[EMAIL PROTECTED]:
}} Python is a better language, with php support, anyway, but I am fed up
}} with attitudes of comp.lang.perl.misc. Assholes in this
On Jul 25, 2:12 pm, Carsten Haese [EMAIL PROTECTED] wrote:
Also, CherryPy's requirements are very
minimal.
In terms of memory and CPU, maybe. But I think that *requires* apache
2.x and a very recent version of mod_python. By web-hosting
standards, those are very steep requirements.
--
Grant,
That might be a memory problem if you are running multiple processes
regularly, such as on a webserver.
--
http://mail.python.org/mailman/listinfo/python-list
Welcome aboard
On 7/25/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Python is a better language, with php support, anyway, but I am fed up
with attitudes of comp.lang.perl.misc. Assholes in this newsgroup ruin
Perl experience for everyone. Instead of being helpful, snide remarks,
On Wed, 25 Jul 2007 20:42:54 +0300, walterbyrd [EMAIL PROTECTED]
wrote:
I'm fairly new to web-development, and I'm trying out different
technologies. Some people wonder why PHP is so popular, when the
language is flawed in so many ways. To me, it's obvious: it's because
it's much easier to
On Wed, 2007-07-25 at 13:55 -0700, walterbyrd wrote:
On Jul 25, 2:12 pm, Carsten Haese [EMAIL PROTECTED] wrote:
Also, CherryPy's requirements are very
minimal.
In terms of memory and CPU, maybe. But I think that *requires* apache
2.x and a very recent version of mod_python. By
Hi all!
I was reading through Python Cookbook the Singleton recipe. At this moment
I am a bit puzzled as the example in the book is not working resulting in:
TypeError: type.__new__(SingleSpam): SingleSpam is not a subtype of type
(I haven't presented the original code as I am not sure about
Say you have this structure:
pna/
__init__.py
model.py
__init__.py is empty.
model.py is:
import cPickle as pickle
class A(object):
pass
def serialize():
pickle.dump(A(), open('temp.dat', 'wb'))
Now open a python interpreter on the root directory of that structure
and
Thanks all! I think I will stick to my original method because the
files can be quite large and without reading the whole file into
memory probably enumerate( open( textfile ) ) is the only way to
access an arbitrary Nth line.
--
http://mail.python.org/mailman/listinfo/python-list
I'm an ex-PHP programmer (well, I still have to use some PHP at work,
but I don't tell anyone that at parties) who now uses Python or Lisp
wherever possible for web development. I can tell you exactly why PHP
is so popular: it acts as an extension of HTML and is syntactically
similar to Perl.
Files should be iterable on their own:
filehandle = open('/path/to/foo.txt')
for line in filehandle:
# do something...
But you could also do a generic lines = filehandle.readlines(), which
returns a list of all lines in the file, but that's a bit memory
hungry.
--
Steve Holden wrote:
When someone starts to push the limits of PHP they either continue to
push until they get where they want to be (producing an ugly or
ill-maintained bunch of code along the way) or they choose a more
appropriate tool.
The latter behavior is typical of programmers. The
[EMAIL PROTECTED] wrote:
Python is a better language, with php support, anyway, but I am fed up
with attitudes of comp.lang.perl.misc. Assholes in this newsgroup ruin
Perl experience for everyone. Instead of being helpful, snide remarks,
back-biting, scare tactings, and so on proliferate and
Neil Cerutti [EMAIL PROTECTED] wrote:
Speaking of the iter builtin function, is there an example of the
use of the optional sentinel object somewhere I could see?
for line in iter(open('somefile.txt', 'r').readline, ''):
print line
--
Carsten Haese wrote:
On Wed, 2007-07-25 at 10:42 -0700, walterbyrd wrote:
Once you start down the Dark path, forever will it dominate your
desiny. Consume you, it will.
- Yoda
I'm fairly new to web-development, and I'm trying out different
technologies. Some people wonder why PHP is so
On Wed, 2007-07-25 at 19:26 +, Neil Cerutti wrote:
Speaking of the iter builtin function, is there an example of the
use of the optional sentinel object somewhere I could see?
Example 1: If you use a DB-API module that doesn't support direct cursor
iteration with for row in cursor, you can
A very simple question: I currently use a cumbersome-looking way of
getting the first, second, etc. line of a text file:
for i, line in enumerate( open( textfile ) ):
if i == 0:
print 'First line is: ' + line
elif i == 1:
print 'Second line is: ' + line
...
walterbyrd wrote:
On Jul 25, 2:12 pm, Carsten Haese [EMAIL PROTECTED] wrote:
Also, CherryPy's requirements are very
minimal.
In terms of memory and CPU, maybe. But I think that *requires* apache
2.x and a very recent version of mod_python. By web-hosting
standards, those are very steep
I've hacked together a small utility program that I assume can be
written much better. The program reads in output from a statistical
program and spits out the relevant data needed. The purpose of the
program is to reach into the original data file (which is a text file),
pull out the relevant
Hi all,
I have a problem. if I enter max(2,3) before I run my program in command
line it returns 3. However if I start to debug my program, I have this
error:
[Dbg] max(2,3)
Traceback (most recent call last):
File interactive input, line 1, in module
TypeError: 'int' object is not callable
Any
On Jul 26, 3:08 am, Stargaming [EMAIL PROTECTED] wrote:
On Wed, 25 Jul 2007 09:16:26 -0700, kyosohma wrote:
On Jul 25, 10:46 am, [EMAIL PROTECTED] wrote:
Hello,
I have a situation where I have a file that contains text similar to:
myValue1 = contents of value1
myValue2 = contents of
1 - 100 of 201 matches
Mail list logo