The APL2007 URL was given incorrectly should be
http://www.sigapl.org/apl2007.html
--
http://mail.python.org/mailman/listinfo/python-list
de Congres, Montreal, Quebec, CANADA
Conference hotel: Hyatt Regency Montreal
Committee
General Chair Guy Laroque [EMAIL PROTECTED]
Program Chair Lynne C. Shaw[EMAIL PROTECTED]
Treasurer Steven H. Rogers [EMAIL PROTECTED]
Publici
On Mar 23, 2:37 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I was told in this NG that string is obsolet. I should use
> str methods.
>
> So, how do I join a list of strings delimited by a given
> char, let's say ','?
>
> Old way:
>
> l=['a','b','c']
> jl=string.join(l,',')
>
> New way?
On Mar 15, 11:13 am, "tonyr1988" <[EMAIL PROTECTED]> wrote:
> if __name__=='__main__':
> x = DemoClass
> x.WriteToFile
>
You meant to create a DemoClass instance object, but instead, you
obtained a reference to the class object. You want 'x = DemoClass()'
instead.
You meant to ca
On Mar 4, 1:15 pm, Jan Danielsson <[EMAIL PROTECTED]> wrote:
>When I run doxygen on my python files, it does document classes, but
> not "standalone" functions.
Look in the doxygen config file for your python project, named
'Doxyfile', for the config setting
'EXTRACT_ALL', and read the commen
Jonathan Mark wrote:
> Some languages, such as Scheme, permit you to make a transcript of an
> interactive console session. Is there a way to do that in Python?
>
Maybe IPython's logging feature is what you want?
http://ipython.scipy.org/doc/manual/node6.html#SECTION00066000
s:
==
help that this
(Cmd) that
That
In your code you could use introspection to locate the plugin commands,
something like
PLUGIN_MODULES = map(__import__, PLUGIN_NAMES)
for module in PLUGIN_MODULES:
for name in dir(module):
if name.startswith('do_')
# print the new list where duplicates are removed
For longer lists the set() method will probably be faster as this one
searches temp for each item.
Kent
>
> def main():
> list, temp = [1, 1, 2, 4, 8, 8, 8, 8, 8, 8, 10], []
> for i in range(len(list)):
>
quot;Ataris Aqußticos #2.py", line 1
> SyntaxError: Non-ASCII character '\xff' in file Ataris Aqußticos #2.py
> on line 1
It looks like you are saving the file in Unicode format (not utf-8) and
Python is choking on the Byte Order Mark that Notepad puts at the
beginning of the d
-
Use + :
In [1]: a=[1,2]
In [2]: b=a+[3]
In [3]: a
Out[3]: [1, 2]
In [4]: b
Out[4]: [1, 2, 3]
Kent
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Matt> In some instances I want to access just the function f, though,
> Matt> and catch the values before they've been decorated.
>
> def f(x):
> return x * x
>
> @as_string
> def fs(x):
> return f(x)
or just
fs =
On Jan 28, 7:46 pm, Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> At Sunday 28/1/2007 11:28, Kent Tenney wrote:
>
> >I want to generate the following file;
>
> >
> >
> >stuff
>
> >How should I be doing this?open("filename","w"
Howdy,
I want to generate the following file;
stuff
How should I be doing this?
As far as I can tell, ElementTree() requires everything
to be inside the root element (leo_file)
Thanks,
Kent
--
http://mail.python.org/mailman/listinfo/python-list
2.4 are in it, too.
No, it is one version back from that. From the Preface to the second
edition: "This edition has been thoroughly updated to reflect Python
2.2...in addition, discussion of anticipated changes in the upcoming 2.3
release have been incorporated."
Kent
--
http://mail.python.org/mailman/listinfo/python-list
What encoding does the NTFS store the filename?
I got some downloaded files, some with Chinese filename, I can not
backup them to CD because the name is not accepted.
I use walk, then print the filename, there are some ? in it, but some
Chinese characters were display with no problem. I suspect t
ds-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list.htm
Kent
--
http://mail.python.org/mailman/listinfo/python-list
s Task Manager or the equivalent.
Jython is a Java application and you can increase the max heap available
the same as for other java apps, using the command line switch -Xmx,
e.g. -Xmx512m to set the max heap to 512 megabytes.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Carl Banks wrote:
> Kent Johnson wrote:
>> Carl Banks wrote:
>>> Now, I think this is the best way to use modules, but you don't need to
>>> use modules to do get higher-level organization; you could use packages
>>> instead. It's a pain if you'
a module - but in general my major classes are
each to a module.
It does make the imports look funny - I tend to give the module the same
name as the class, Java style, so I have
from foo.bar.MyClass import MyClass
but that is a minor point IMO.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> Stephen Eilert wrote:
>
>> I do think that, if it is faster, Python should translate
>> "x.has_key(y)" to "y in x".
>
> http://svn.python.org/view/sandbox/trunk/2to3/fix_has_key.py?view=markup
Seems to have moved to here:
http://svn.python.org/view/sandbox/trunk/2to3/fixes
;>> reload(main)
> ### Execution Occurs ###
If you edit music.py you will have to
import music
reload(music)
to get the new music module, then
reload(main)
to run again.
You could just type
> python main.py
at the command line each time you want to run, or use an editor that
lets you run the program from within the editor.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
gly, and a callable class is the Right Thing -- if there's a
> way to actually make it work.
If the only reason for a callable class is to save a single value (the
original function), you could instead store it as an attribute of the
wrapper function.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
gly, and a callable class is the Right Thing -- if there's a
> way to actually make it work.
If the only reason for a callable class is to save a single value (the
original function), you could instead store it as an attribute of the
wrapper function.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Steven D'Aprano wrote:
> On Wed, 29 Nov 2006 19:42:16 -0800, rjtucke wrote:
>
>> I want an iterable from 0 to N except for element m (<=M).
> x = range(m-1) + range(m+1, N)
Should be range(m) + range(m+1, N)
Kent
--
http://mail.python.org/mailman/listinfo/python-list
this, preferably without regexp?
What do you have against regexp? re.split() does exactly what you want:
In [1]: import re
In [2]: re.split(r'(:=|\+)', 'a:=b+c')
Out[2]: ['a', ':=', 'b', '+', 'c']
Kent
--
http://mail.python.org/mailman/listinfo/python-list
robert wrote:
> I want to use a computation cache scheme like
>
>
> o = CACHECOMPUTE complex-key-expr expensive-calc-expr
>
>
> frequently and elegantly without writing complex-key-expr or
> expensive-calc-expr twice.
> So its ugly:
>
> _=complex-key-expr; o=cache.get(_) or
> cache
John Salerno wrote:
> I'm a little confused. Why doesn't s evaluate to True in the first part,
> but it does in the second? Is the first statement something different?
>
> >>> s = 'hello'
> >>> s == True
> False
> >>> if s:
> print 'hi'
>
>
> hi
> >>>
>
> Thanks.
Excellent question!
.
> are being parsed as the same rule so the system will call a later
> function with minutes=5 as parameter.
Maybe one of these will help:
http://cheeseshop.python.org/pypi/parsedatetime/0.7.4
http://cheeseshop.python.org/pypi/when/1
Kent
--
http://mail.python.org/mailman/listinfo/python-list
ke an intermediary function:
>
> def key_fn(key):
>return key_dict[key]
Try key=key_dict.__getitem__
In [3]: d=dict(a=1,b=2)
In [4]: d.__getitem__('a')
Out[4]: 1
Kent
--
http://mail.python.org/mailman/listinfo/python-list
7;s readable for someone who
> has learned programming ages ago with Pascal and is now using Python because
> he _hates_ everything that remotely ressembles to any mutation of
> C(++/#/Java).
Examples are mostly Java and C#, sorry!
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Mark Elston wrote:
> * Kent Johnson wrote (on 9/30/2006 2:04 PM):
>> John Salerno wrote:
>>> So my question in general is, is it a good idea to default to an OOP
>>> design like my second example when you aren't even sure you will need
>>> it? I know i
so clearly at work the difference
between projects that practice YAGNI and those that are designed to meet
any possible contingency. It's the difference between running with
running shoes on or wet, muddy boots.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Hi Stéphane,
>
> stéphane bard wrote:
>> hello, my boss ask me to prefer windev to python.
>> I have to argue
>
> First, no matter how good is Python, you should not desagree with your
> boss.
> Second, Windew is quite good and fun, you will love it.
Yes, the boss is a
noro wrote:
> Is there a more efficient method to find a string in a text file then:
>
> f=file('somefile')
> for line in f:
> if 'string' in line:
> print 'FOUND'
Probably better to read the whole file at once if it isn't too big:
f = file('somefile')
data = f.read()
if 'string' in
Dick Moores wrote:
> At 06:30 PM 9/10/2006, Kent Johnson wrote:
>> Dick Moores wrote:
>>> Also, why do you use TextPad instead of IDLE?
>> You're kidding, right?
>
> No. Tell me, please. Macros? Comparing files? What else?
OK...please, no one interpret this as
ad of IDLE?
You're kidding, right?
Kent
--
http://mail.python.org/mailman/listinfo/python-list
le
Init fldr: $FileDir
regex to match output:
^.*"([^"]+)", *line ([0-9]+)
with File: 1, Line: 2
Kent
--
http://mail.python.org/mailman/listinfo/python-list
> feed_list = open("feed_listing.conf","r")
What could it be about the above line that means "Open this file for
READ ONLY"?
--
http://mail.python.org/mailman/listinfo/python-list
ydoc 3.0 development?
Thanks,
Kent
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> I'm new at Python and I need a little advice. Part of the script I'm
> trying to write needs to be aware of all the files of a certain
> extension in the script's path and all sub-directories.
What you want is os.walk().
http://www.python.org/doc/current/lib/os-file-d
om Daycos.TableCopier.copyfro import StateProcessor
>>>> print StateProcessor.__class__.__name__
> type
>
> I'm looking for something that would print 'StateProcessor' but am not
> having much luck.
It looks like StateProcessor is a class; StateProcessor
How about using os.listdir to build a list of filenames, then sorting
them by modification time (via os.stat)?
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> You may want to look at pexpect:
>
> http://pexpect.sourceforge.net/
>
> But I am not sure about its support on windows.
To the best of my recent investigation, and an email exchange with the
author of pexpect, it is NOT supported under Windows.
--
http://mail.python.
o your feedback!
>
> Feel free to pass this along to your friends.
>
> Thanks in advance for your help and good luck!
Kent
--
http://mail.python.org/mailman/listinfo/python-list
gmax2006 wrote:
> Hi,
>
> I am developing scripts that must run on both Linux and windows.
>
> My scripts contain lots of relative paths (such as log\\log.txt or
> ctl\\table.ctl) If I use os.sep, it makes the code ugly. Is there any
> tips or techniques to have Python automatically converts \\ to
rwboley wrote:
> My question is: how can I make that graphing step easier? Ideally I'd
> like the chart to exist on it's own page, but I have no idea where to
> even begin to implement this. Any thoughts would be appreciated.
I've seen several people recommend matplotlib for this kind of thing.
[EMAIL PROTECTED] wrote:
> Hello,Im using Python 2.4.2 and I'm starting a few very basic
> programs,but theres two problems I've not found the answers for.
> My first problem is I need code that will count the number of letters
> in a string and return that number to a variable.
>>> s = "hello"
>
James Mitchelhill wrote:
> Sorry for the clunky subject line - I have a feeling that not knowing
> the proper terms for this is part of my problem.
>
> I'm trying to write a class that analyses some data. I only want it to
> do as much work as necessary, so it saves method results to a
> dictionary
Roman wrote:
> Thanks for your help
>
> My intention is to create matrix based on parsed csv file. So, I would
> like to have a list of columns (which are also lists).
>
> I have made the following changes and it still doesn't work.
>
>
> cnt = 0
> p=[[], [], [], [], [], [], [], [], [], [], []]
>
Roman wrote:
> I would appreciate it if somebody could tell me where I went wrong in
> the following snipet:
>
> When I run I get no result
>
> cnt = 0
> p=[]
> reader = csv.reader(file("f:\webserver\inp.txt"), dialect="excel",
> quotechar="'", delimiter='\t')
> for line in
[EMAIL PROTECTED] wrote:
> I found a way to create "Open File" or "Open Folder" windows dialog
> boxes, but not to create an easier Yes / No dialog box...
> Maybe someone has a solution for this?
Maybe you would like EasyGui
http://www.ferg.org/easygui/
Kent
--
h
David Vincent wrote:
> > import unittest
> >
> > class IntegerArithmenticTestCase(unittest.TestCase):
> > def testAdd(self): ## test method names begin 'test*'
> > assertEquals((1 + 2), 3)
> > assertEquals(0 + 1, 1)
assertEquals is a member function, inherited from unittest.T
FAST 0 (h)
12 RETURN_VALUE
Thanks Fredrik!
Kent
--
http://mail.python.org/mailman/listinfo/python-list
. Found the globals() built-in...
You can also
import __main__
tests = [x for x in dir(__main__) if x.endswith("test")]
for test in tests:
getattr(__main__, test)()
but I second the suggestion of looking in to unittest or one of the
other test frameworks.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Yes, you can go that route. But since it appears that what you are
doing is unit testing related, and you are interested in aranging for
all of your unit test cases to be run automatically, I'd suggest using
the unittest module.
--
http://mail.python.org/mailman/listinfo/python-list
MTD wrote:
> Hello,
>
> I'm wondering if there's a quick way of resolving this problem.
>
> In a program, I have a list of tuples of form (str,int), where int is a
> count of how often str occurs
...
> So clearly that doesn't work... any ideas?
Yes, use the proper tool for the job. Tuples are
gexp
> compilation where input is unknown...?
Maybe you want
pat = re.compile(re.escape(userinput))
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Kent Johnson wrote:
> Laszlo Nagy wrote:
>> But I do not know how to create an XML RPC server in Python that uses
>> HTTPS for XML transports.
>
> This recent recipe seems to do exactly what you want:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496786
It w
Laszlo Nagy wrote:
> But I do not know how to create an XML RPC server in Python that uses
> HTTPS for XML transports.
This recent recipe seems to do exactly what you want:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496786
Kent
--
http://mail.python.org/mailman/listinfo/
try
args = (name,) + params['args']
except KeyError:
args = ()
params['func'](*args)
Or include the 'name' parameter in the arg list and use an empty tuple
for the arg to pwldef:
'exp' : {'func': self.arbtrandef, 'args':('exp', 2,4)},\
'pwl' : {'func': self.pwldef, 'args': ()},\
for name, params in alldict.items():
params['func'](*args)
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Laurent Pointal wrote:
> And I'll maintain a fixed URL at
>
> http://laurent.pointal.org/python/pqrc/
Broken at the moment.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Stefan Behnel wrote:
> Hallo everyone,
>
> I have the honour to announce the availability of lxml 1.0.
>
> http://codespeak.net/lxml/
>
> It's downloadable from cheeseshop:
> http://cheeseshop.python.org/pypi/lxml
Are there any plans to offer a Windows inst
ncs.html
Also take a look at the section on string methods:
http://docs.python.org/lib/string-methods.html
Kent
--
http://mail.python.org/mailman/listinfo/python-list
[3]: a==b
Out[3]: True
In [4]: a/2 == b/2
Out[4]: False
Kent
--
http://mail.python.org/mailman/listinfo/python-list
kfiles('*.foo'):
# process a .foo file here
http://www.jorendorff.com/articles/python/path/index.html
Kent
--
http://mail.python.org/mailman/listinfo/python-list
robin wrote:
> from SOAPpy import WSDL
> WSDLFILE = '/pathtomy/googleapi/GoogleSearch.wsdl'
> APIKEY = ''
> _server = WSDL.Proxy(WSDLFILE)
Robin, note this part of the URI set in WSDLFILE:
'/pathtomy/googleapi'. Get it? 'path to my google api'. You must set
this part to the actual path wh
; The generator comprehension needs to create a new generator each time
> around.
Reusing the generator doesn't give a correct answer; after the first
sum() the generator is exhausted:
In [1]: g=(int(L) for L in xrange(10))
In [2]: sum(g)
Out[2]: 45
In [3]: sum(g)
Out[3]: 0
Kent
--
http://mail.python.org/mailman/listinfo/python-list
existing dictionaries only using
JPython libraries.
How do you access the dictionary files from Python? The same thing may
work in Jython. For example importing the file, if it is Python syntax,
should work in Jython; also I think format 0 (text) and format 1 pickles
are compatible with Jython.
Kent
for membership in a set is much faster
than searching a large list.
- Find a better algorithm ;)
Kent
--
http://mail.python.org/mailman/listinfo/python-list
I need to compile Python on OpenServer 5 because I need to 'freeze'
our Python app, and running 'freeze' requires a working, compilable
source installation of Python.
--
http://mail.python.org/mailman/listinfo/python-list
If anyone is successfully compiling Pyton 2.3 on an SCO OpenServer 5
box, I'd appreciate hearing from you on how you managed to do it. So
far, I'm unable to get a python that doesn't coredump.
--
http://mail.python.org/mailman/listinfo/python-list
Zameer wrote:
> I wonder where the "else" goes in try..except..finally...
>
try / except / else / finally
See the PEP:
http://www.python.org/dev/peps/pep-0341/
Kent
--
http://mail.python.org/mailman/listinfo/python-list
er instead of just the typical [A-Z],
> which doesn't include, for example É. Is there a way to do this, or
> do I have to stick with using the isupper method of the string class?
>
See http://tinyurl.com/7jqgt
Kent
--
http://mail.python.org/mailman/listinfo/python-list
manstey wrote:
> Hi,
>
> How do I convert a string like:
> a="{'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}"
>
> into a dictionary:
> b={'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}
Try this recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Reci
ting it seems to depend on from which partition I
> start Python.
Probably you have multiple copies of selfservicelabels.py or an old
selfservicelabels.pyc that is being imported. Try
import selfservicelabels
print selfservicelabels.__file__
to see where the import is coming from.
Kent
Can anyone point me to a GUI program that allows viewing and browsing
the output of the profiler? I know I have used one in the past but I
can't seem to find it...
Thanks,
Kent
--
http://mail.python.org/mailman/listinfo/python-list
mething like this?
out = None
for line in open(...):
if line.startswith('H'):
if out:
out.close()
out = open(..., 'w')
if out:
out.write(line)
out.close()
Kent
--
http://mail.python.org/mailman/listinfo/python-list
softwindow wrote:
> the re module is too large and difficult to study
>
> i need a detaild introduction.
>
http://www.amk.ca/python/howto/regex/
Kent
--
http://mail.python.org/mailman/listinfo/python-list
When you did:
b = a[:]
b was then a copy of a, rather than just a reference to the same a.
But what does a contain? It contains two sublists -- that is, it
contains references to two sublists. So b, which is now a copy of a,
contains copies of the two references to the same two sublists.
What y
tribute, not a class attribute. You need to
refer to self._listbox_1 from a CustomFront method, or change _listbox_1
to a class attribute if that is what you really want.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
rrent/doc/misc.html#the-py-std-hook
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Alternately you can use an attribute of the function to save the state:
In [35]: def f(a):
: f.b += a
: return f.b
:
In [36]: f.b=1
In [37]: f(1)
Out[37]: 2
In [38]: f(2)
Out[38]: 4
Kent
--
http://mail.python.org/mailman/listinfo/python-list
k a little harder:
for f in path.path('.\InteropSolution').walkfiles():
if f.fnmatch('*.dll') or f.fnmatch('*.exe'):
print f
or maybe
for f in path.path('.\InteropSolution').walkfiles():
if f.ext in ['.dll', '.exe']:
print f
http://www.jorendorff.com/articles/python/path/index.html
Kent
--
http://mail.python.org/mailman/listinfo/python-list
sage explaining what is wrong.
I would just use the file normally in the test. If it's not there you
will get an IOError with a traceback and a helpful error message.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Sure, are there any available simulators...since i am modifying some
> stuff i thought of creating one of my own. But if you know some
> exisiting simlators , those can be of great help to me.
http://simpy.sourceforge.net/
--
http://mail.python.org/mailman/listinfo/pyth
art = 0
while True:
m = pattern.search(string, start)
if not m: break
ans.append( (m.start(), m.end()) )
start = m.start() + 1
print ans # => [(0, 2), (2, 4), (4, 6), (6, 8), (8, 10), (10, 12), (12, 14)]
Kent
--
http://mail.python.org/mailman/listinfo/python-list
se.
>
> This software tool needs to work on a variety of different computers; Win95,
> Win98, WinXP, Mac, Linux.
Take a look at Tkinter, it is pretty easy to get started with and good
for making simple GUIs. Look at the csv module for writing the data to
files.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
John Salerno wrote:
> Call
> me crazy, but I'm interested in regular expressions right now. :)
Not crazy at all. REs are a powerful and useful tool that every
programmer should know how to use. They're just not the right tool for
every job!
Kent
--
http://mail.python.org/
inations for hints).
Filter with the regex. Halting is left as an exercise for the reader.
(Halting when the length reaches a predetermined limit would be one way
to do it.)
Kent
--
http://mail.python.org/mailman/listinfo/python-list
paragraph + '\n\n'"
In [20]: re.sub(r"'' \+ (.*?) \+ '\n\n'", r"'%s\n\n' %
\1", test)
Out[20]: "self.source += '%s\n\n' % paragraph"
Kent
--
http://mail.python.org/mailman/listinfo/python-list
again which just moved the
> ugliness to another position.
This is fine. You don't need 'global' statements to read global
variables, function1() can be simply
def function1():
print debugFlag
Kent
--
http://mail.python.org/mailman/listinfo/python-list
strophe character in another
> character set? If so, which character set?
\x92 is a right single quote in Windows cp1252.
http://www.microsoft.com/globaldev/reference/sbcs/1252.mspx
Kent
--
http://mail.python.org/mailman/listinfo/python-list
> systems.
One of these might be helpful:
http://developer.berlios.de/projects/plugboard/
http://termie.pbwiki.com/SprinklesPy
Kent
--
http://mail.python.org/mailman/listinfo/python-list
d =ffgtyuf == =tyryr =u=p ff"
In [3]: re.sub('=.', '=#', s)
Out[3]: 'tyrtrbd =#fgtyuf =# =#yryr =#=# ff'
If the replacement char is not fixed then make the second argument to
re.sub() be a callable that computes the replacement.
PS str is not a good name
Gary Wessle wrote:
> ps. is there a online doc or web page where one enters a method and it
> returns the related docs?
The index to the library reference is one place:
http://docs.python.org/lib/genindex.html
and of course help() in the interactive interpreter...
Kent
--
on of the loop. (Though you
will need a separate test to terminate the loop when there are no more
lines.)
You can iterate an open file directly; here is a shorter version:
for line in open('test.dat'):
line = line.rstrip('\n')
if line:
print line
Kent
>
Python 2.4.2 (#1, Nov 29 2005, 14:04:55)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> d = "/home/testuser/projects"
>>> os.path.basename(d)
'projects'
>>> os.path.dirname(d)
'/home/testuser'
>>>
--
I V wrote:
> Incidentally, does python have a built-in to do a binary search on a
> sorted list? Obviously it's not too tricky to write one, but it would be
> nice if there was one implemented in C.
See the bisect module.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
rs is handling malformed html.
Beautiful Soup is intended to handle malformed HTML and seems to do
pretty well.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Out[3]: 0
In [4]: lst[5]()
Out[4]: 5
A list comp makes this IMO cleaner:
In [5]: lst = [ lambda i=i: i for i in range(10) ]
In [6]: lst[0]()
Out[6]: 0
In [7]: lst[5]()
Out[7]: 5
Kent
--
http://mail.python.org/mailman/listinfo/python-list
101 - 200 of 792 matches
Mail list logo