st):
> File "", line 1, in ?
> NameError: name 'cmp5' is not defined
>
> (I was hoping that cmp5 meant it would use the 5th item in the lists to
> sort across)
>
> >>> lBooks.sort(key=lambda i:i[4])
>
> Traceback (most recent call last):
> File "", line 1, in ?
> File "", line 1, in
> IndexError: string index out of range
>
>
> (I was hoping for similar things)
>
>
> would you be so kind as to point me in the right direction?
>
> THanks!
>
> googleboy
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
File "", line 1, in ?
> NameError: name 'cmp5' is not defined
>
> (I was hoping that cmp5 meant it would use the 5th item in the lists to
> sort across)
>
> >>> lBooks.sort(key=lambda i:i[4])
>
> Traceback (most recent call last):
> File "", line 1, in ?
> File "", line 1, in
> IndexError: string index out of range
>
>
> (I was hoping for similar things)
>
>
> would you be so kind as to point me in the right direction?
>
> THanks!
>
> googleboy
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
pixels
at the end of a line for "rounding errors" and will filter for a limited
alphabet consisting only of the numbers, the captial letters, and the space.
I think I can do this given these limitations.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 9515
newbie wrote:
[about some tkinter problems]
I'm running:
Python 2.3.4 (#4, Oct 25 2004, 21:40:10)
[GCC 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)] on linux2
With tcl/tk 8.3 and your first sample works as expected.
> I am running PYTHON and Tkinter on a windows' XP box.
This is probably your proble
Dan M wrote:
> I'm writing a Python replacement for a particularly ugly shell script. we
> are running mimedefang on our mail server, moving spam and virus messages
> to a quarantine directory. This little python script successfully chdir's
> to the quarantine directory, identifies all of the quara
[EMAIL PROTECTED] wrote:
> Hi,
>
> I need to call a python script, with command line arguments (it is an
> autonomous script with a __main__), from within another python script.
> Can I use exec() or execfile() for this? How to pass the arguments?
>
> Thanks,
>
> Olivier.
>
Obligatory "ugh."
Larry Bates wrote:
> You can pass arguments into a python script, see getopt module.
> Then to call an external script you would use subsystem module
> (or os.system if you are on earlier version of python).
I think getopt is a little dated. Try optparse. To quote the python
documentation, it is
headspin wrote:
> I know how to switch a label from text to an image; simply config the
> image property to an existing image.
>
> But how do you do the opposite? Once a label displays an image, how do
> you switch it back to displaying text? Setting the image property to
> None doesn't seem to do
I know this is despised, but I am actually testing this list with an
email. If you knew the circles I've been running around trying to get
UCLA to fix their news server for the c.l.python list, you would not
blame me. The hours I've wasted on this. I just want to be able to use
this list with a
James Stroud wrote:
> I know this is despised, but I am actually testing this list with an
> email. If you knew the circles I've been running around trying to get
> UCLA to fix their news server for the c.l.python list, you would not
> blame me. The hours I've wasted on t
Grant Edwards wrote:
> On 2005-12-15, James Stroud <[EMAIL PROTECTED]> wrote:
>
>
>>I know this is despised, but I am actually testing this list with an
>>email. If you knew the circles I've been running around trying to get
>>UCLA to fix their news ser
Nicholas Shewmaker wrote:
> (I apologize if this posts twice. My AVG is being fussy.)
>
> From what I've read, MouseWheel is a very tricky event. I have
> replaced my Python tcl84.dll and tk84.dll files with those in the
> ActiveTcl distribution to fix the crashes caused by the event. Then, I
Alex Hunsley wrote:
> Can anyone recommend some code for creating drop-down menus in tkinter?
> To be absolutely clear, here's an example of a drop-down:
>
> http://www.google.co.uk/preferences?hl=en
> (see the language selection widget)
>
> I've found the odd bit of code here and there, such as:
Dustan wrote:
> I'm a newbie here, especially with Tkinter. I'm writing a program that
> has 3 phases, if you will, in which I would have to clear the window
> and insert new widgets. Is this possible, and if so, how? I'm writing
> my application class based on Frame, if that helps at all.
>
It
Tuvas wrote:
> I'm trying to display a picture on a Tkinter Canvas. It seems to work
> fine the first time that it is displayed. However, subsequent times
> running shows an error like this:
>
> TCLerror: Wrong # args: should be ".-1211472948 .-1211470996 addtag tag
> searchCommand ?arg arg ...?
>
Tuvas wrote:
> I'm trying to display a picture on a Tkinter Canvas. It seems to work
> fine the first time that it is displayed. However, subsequent times
> running shows an error like this:
>
> TCLerror: Wrong # args: should be ".-1211472948 .-1211470996 addtag tag
> searchCommand ?arg arg ...?
>
cm012b5105 wrote:
> Hello i am fairly new to python,
> I have written an interactive programme a small example of it is here.
> s = raw_input ("Do you have any children? ")
> if s== 'yes':
>print "Thats great"
> elif s=='no':
>print "Well my boss has 2"
>
>
> Now i have also been looking
[EMAIL PROTECTED] wrote:
> Dicts and sets require immutable keys, like tuples or frozensets
Not really...
def freeze(anobj):
"""returns a new hashable object"""
import copy
try: hash(anobj)
except: pass
else: return copy.deepcopy(anobj)
class FrozenType(type):
def __new__(c
Dustan wrote:
> How do I limit what the user can enter in an Entry Widget? I know I can
> set it to display '*' to hide a password, but what I want to do is
> limit the contents to numeric characters. What is the easiest way of
> doing this?
>
You can check the source of tkSimpleDialog.askfloat,
Hello All,
I am helping someone write a python script to run their DOS application
through an SSH terminal. It seems that this program wants to access a
DOS shell and send output there. If running remotely, this causes a
problem because it locks up the program. The program seems (to me) to be
braver wrote:
> I need a magical expanding hash with the following properties:
>
> * it creates all intermediate keys
>
> meh['foo']['bar] = 1
>
> -- works even if meh['foo'] didn't exist before
>
> * allows pushing new elements to leaves which are arrays
>
> meh['foo']['list] << elem1
> meh['
Peter Hansen wrote:
> James Stroud wrote:
>
>> I am helping someone write a python script to run their DOS
>> application through an SSH terminal. It seems that this program wants
>> to access a DOS shell and send output there. If running remotely, this
>> causes
braver wrote:
> Well, I know some python, but since there are powerful and magical
> features in it, I just wonder whether there're some which address this
> issue better than others.
>
In python, += is short, of course, for
a = a + 1
But if we haven't already assigned a, how does the interpret
braver wrote:
> Thanks, James! This is really helpful.
>
> : It would take a lot of coding to make that << work right. Better is
> the pythonic
> :
> : m[key] = [value]
> :
> : Its really only one more keystroke than
> :
> : m[key] << value
>
> But it's only for the first element, right? I'd ha
[EMAIL PROTECTED] wrote:
> I've noticed that there's a few functions that return what appears to
> be a tuple, but that also has attributes for each item in the tuple.
> For example, time.localtime() returns a time.time_struct, which looks
> like a tuple but also like a struct. That is, I can do:
Would anyone else find this syntax useful for generator expressions?
py> [x for x in '1234' if x%2 else 'even']
[1, 'even', 3, 'even']
I'm guessing this has been suggested before?
James
--
http://mail.python.org/mailman/listinfo/python-list
James Stroud wrote:
> Would anyone else find this syntax useful for generator expressions?
>
> py> [x for x in '1234' if x%2 else 'even']
> [1, 'even', 3, 'even']
>
> I'm guessing this has been suggested before?
>
> James
[EMAIL PROTECTED] wrote:
> I'm playing with a sudoku GUI...just to learn more about python.
>
> I've made 81 'cells'...actually small canvases
>
> Part of my scheme to write the cells (all 81 of them in the gui) to a file
> (using the the SAVE callback/button), then
> restore the gui cells from
[EMAIL PROTECTED] wrote:
> On Sat, 21 Jan 2006 14:23:49 -0800, James Stroud <[EMAIL PROTECTED]> wrote:
>
>
>>[EMAIL PROTECTED] wrote:
>>
>>>I'm playing with a sudoku GUI...just to learn more about python.
>>>
>>>I've made 81 'c
py wrote:
> i have a website which runs apache on linux. it supports python (i
> think via cginot sure how else). anyway how can I go to a web page
> and run a python script or something like that? for example say i make
> a script which prints out all the links on another URLhow can i r
would it be best
> for me to do this with a
> multi-diminsional array? For example: sort the file, read a rec into
> the array, if the next rec is the same then incr the count, otherwise
> add a new rec with a count of 1. Then write the array to a file?
>
Ah, a real question. Use a
John Machin wrote:
> James Stroud wrote:
>
>>walterbyrd wrote:
>>
>>>This is the first real python program I have ever worked on. What I
>>>want to do is:
>>>1) count identical records in a cvs file
>>>2) create a new file with quantities i
-boot of Linux or maybe a VMWare install to
> program under Python?
>
I recommend a triple boot mac.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
r')
than
"\\".join(['my', 'favorite', 'dir'])
because the latter will bonk on linux. The former is platform
independent. This hits at the same issue as using os.sep:
os.sep.join(['my', 'favorite', 'dir'])
But os.pat
Dave Opstad wrote:
> In article <[EMAIL PROTECTED]>,
> James Stroud <[EMAIL PROTECTED]> wrote:
>>I am trying to create a semi-standalone with the vendor python on OS X
>>10.4 (python 2.3.5). I tried to include some packages with both
>>--packages from the
t.
>
> What is particularly disappointing is the absence of a Windows IDE
I'm a complete windows novice (as in I've forced myself to forget my
experiences with it), but does windows not run vim?
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
oc/python.html
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
n float(pct)
def get_values():
prompts = ['gross product', 'net outsource', 'sales quota']
while True:
try:
pcts = get_pcts(prompts)
return dict(zip(prompts, pcts))
except ValueError, e:
print e
print 'Try again dude.'
"""
Here's a test
>>> print get_values()
Input percent of gross product:21
Input percent of repleat divisional:22
Input percent of sales quota:57
{'sales quota': 57.0, 'gross product': 21.0, 'net outsource': 22.0}
"""
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
James Stroud wrote:
> sam wrote:
>
>> hi all,
>>
>> i'm starting to put together a program to simulate the performance of
>> an investment portfolio in a monte carlo manner doing x thousand
>> iterations and extracting data from the results.
>>
>
r:
print "You messed up, try again."
Now, all testing is done at the point where it is needed. There are no
running totals that could cause accounting errors, your final data
structure is an easy to use dict, unecessary tests have been eliminated,
loops have been de-nested visually and logically, and, most importantly,
the indentation level is kept manageable.
I think you will be able to see how this latter code evolved from yours.
I used to program just like you and it has taken me a few years to
develop these little rules for tightening my code.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
James Stroud wrote:
> sam wrote:
>
>> this does what i want, though i don't like the inner while loop having
>> to be there
[snip]
> A little cleaner. Now, lets tighten it up a bit more, and put nested
> loops into functions. Im getting rid of keeping track of th
>
> --
> Claus Tondering
>
Maybe think about using the Toplevel.withdraw() method. This way you
don't have to re-instantiate your window every time. This is the
technique used by the PMW library. Use deiconify() to get it back.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
would then like to set the camera and have the scene depicted as a
line drawing (not ray-traced solid body, etc).
Does anyone know of a library to do this?
James
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
James Stroud wrote:
> Hello All,
>
> I'm looking for a program to do line-drawings in 3d, with output to
> postscript or svg or pdf, etc. I would like to describe a scene with
> certain 1-3d elements oriented in 3d space with dashed or colored lines
> and filled or t
Steven D'Aprano wrote:
> If I want to iterate over part of the list, the normal Python idiom is to
> do something like this:
>
> alist = range(50)
> # first item is special
> x = alist[0]
> # iterate over the rest of the list
> for item in alist[1:]
> x = item
>
> The important thing to notic
James Stroud wrote:
> Steven D'Aprano wrote:
>> If I want to iterate over part of the list, the normal Python idiom is to
>> do something like this:
>>
>> alist = range(50)
>> # first item is special
>> x = alist[0]
>> # iterate over the rest of
Hello All,
I have been moving to managing a lot of my code with SVN and I have
found it to work extremely well. However, I'm not exactly sure how to
deal with all of the .pyc files that get created every time I test a
project or package. How do people manage this? Do you run a script to
find f
Everyone wrote:
[something helpful]
Thank you to everyone for your responses.
James
--
http://mail.python.org/mailman/listinfo/python-list
Wijaya Edward wrote:
> Can anybody suggest any references (links, books, etc)about this?
> I'm thinking of something similar with D.Conway's "Perl Best Practice".
>
> -- Edward WIJAYA
> SINGAPORE
>
> Institute For Infocomm Research - Disclaimer -
> This email is confiden
e extra info here.'
py>
py> options, args = parser.parse_args()
py>
py> parser.print_help()
Usage: dosomething [options] path
Options:
-h, --help show this help message and exit
-a, --all don't skip hidden or binary files
Some extra info here.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Hi all --
>
> Compared to the Python I know and love, Ruby isn't quite the same.
> However, it has at least one terrific feature: "blocks". Whereas in
> Python a
> "block" is just several lines of locally-scoped-together code, in Ruby
> a
> "block" defines a closure (an
b.bob0
128
py> b.bob1
128
py> b.bob1 = 258
py> b.bob1
2
py> b.bob3
128
py> dir(b)
['__class__',
'__delattr__',
'__dict__',
'__doc__',
'__getattribute__',
'__hash__',
'__init__',
'__module__'
.
That they wouldn't be seems an implementation bug and perhaps that bug
should be fixed rather than promoting the avoidance of (2) because it
does not create classes that behave as number (1).
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA
ide symmetry for reversing any sequence (without requiring
an iterator).
(1,2,3).reversed()
"123".reversed()
[1,2,3].reversed()
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
Paul Boddie wrote:
> James Stroud wrote:
>>(1,2,3).reversed()
>>
>>"123".reversed()
>>
>>[1,2,3].reversed()
>
> I guess Python 2.5 has the reversed method of which you speak.
Not that I could find (as methods of any built in sequence type). 2.5
Fredrik Lundh wrote:
> James Stroud wrote:
>
> > without requiring an iterator
>
> can we perhaps invent some more arbitrary constraints while we're at it?
>
>
>
Why does it seem to me that you are confusing convienience with
constraint, or are the two equi
Fredrik Lundh wrote:
> James Stroud wrote:
>
> > without requiring an iterator
>
> can we perhaps invent some more arbitrary constraints while we're at it?
>
>
>
I guess while I'm at it, this thread wouldn't have so much steam were
these idioms see
t; paradigm to go with the new language I'm trying to learn? I had hoped to
> reduce my learning curve, but I'm very concerned that I simply can't do
> what I want to do with Tkinter. What do other Tkinter developers think?
Its used in pymol. Also, look at my modest program a
Neil Cerutti wrote:
> On 2006-10-19, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
>
>>James Stroud wrote:
>>
>>
>>>without requiring an iterator
>>
>>can we perhaps invent some more arbitrary constraints while
>>we're at it?
>
>
s is just a cheap attempt at
> getting free survey data.
>
> - alex23
>
They would get more data if they lowered their expectations for the
programmer position.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
BartlebyScrivener wrote:
> I am a mere hobbyist. Spent several hours trying to make a class,
> because I think this is an occasion where I need one. But I can't make
> it work.
>
> This code "works" (only because of the global c, which I know I'm
> supposed to avoid, by using a Class). I edited th
Fulvio wrote:
> ***
> Your mail has been scanned by InterScan MSS.
> ***
>
>
> On Friday 20 October 2006 14:34, James Stroud wrote:
>> You really don't need classes for this
>
> I'm in that matter too. Does
oneously (for me) gets:
> {'a': 0, 'c': 2, 'd': 3}
>
> Thanks for your help.
>
I think you have the right idea if I understand what you want:
c = dict(((k,v) for (v,k) in enumerate(x for x in a if b.has_key(x
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
good grounding
> in the basic concepts.
>
> http://docs.python.org/tut/>
>
The values in the example are sequentially ordered wrt the keys, which
is perhaps what the OP intends.
c = dict(((k,v) for (v,k) in enumerate(x for x in sorted(a.keys()) if
b.has_key(x
But, yes,
Steven D'Aprano wrote:
> On Sat, 28 Oct 2006 18:56:33 +1000, Ben Finney wrote:
>
>> "frankie_85" <[EMAIL PROTECTED]> writes:
>>
>>> I just made a simple code which is part of my assignment
>> You may want to review the restrictions your educational institution
>> has on collusion.
> [snip]
>> Agai
he loop variable
> when executing the "def" statement.
>
> Andrea
Yet another way to skin the same cat, maybe even less ugly, depending on taste.
def make_inner(i):
def inner():
return i
return inner
def functions():
return [make_inner(i) for i in range(5)]
pri
I think that it would be handy for enumerate to behave as such:
def enumerate(itrbl, start=0, step=1):
i = start
for it in itrbl:
yield (i, it)
i += step
This allows much more flexibility than in the current enumerate,
tightens up code in many cases, and seems that it would break
James Stroud wrote:
> I think that it would be handy for enumerate to behave as such:
>
> def enumerate(itrbl, start=0, step=1):
> i = start
> for it in itrbl:
> yield (i, it)
> i += step
>
> This allows much more flexibility than in the current enumerate,
Fredrik Lundh wrote:
> why is it this function's job to add an offset to the actual sequence
> index?
>
>
The code is for an economist. She is insistent on starting with the
first bin as 1. I'm guessing, practically, binning linerizes data and
the bin number may potentially become a divisor o
Fredrik Lundh wrote:
> James Stroud wrote:
>
>> def enumerate(itrbl, start=0, step=1):
>>i = start
>>for it in itrbl:
>> yield (i, it)
>> i += step
>
> that's spelled
>
> izip(count(start), sequence)
>
> in to
Fredrik Lundh wrote:
> James Stroud wrote:
>
>> The code is for an economist. She is insistent on starting with the
>> first bin as 1.
>
> leaky abstractions in reverse, in other words? that's not a good design
> approach.
>
>
>
I'm not sure I
Fredrik Lundh wrote:
> James Stroud wrote:
>
>> The code is for an economist. She is insistent on starting with the
>> first bin as 1.
>
>
> leaky abstractions in reverse, in other words? that's not a good design
> approach.
>
>
>
Okay, I'
o much criticism, I challenge even the most skilled python
programmer to find his or her own faculty economist (or statistician or
physicist) and get them to radically change their computational tools.
When you've walked a mile in my shoes, leaky abstractions won't seem
like such a b
Steve Holden wrote:
> How could you end up marrying
> someone who counts from one and not zero? ;-)
She's the only other person I've ever met who used vi key binding at the
command line.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los A
HYRY wrote:
> I want to add some simple search function for my homepage. It need to
> search through all the html files of my homepage (about 300 pages), and
> highlight the search words.
>
> I made some test with HTMLParser, it works but slow. So, my question is
> how can I improve its speed?
>
George Sakkis wrote:
> It occured to me that most times I read a csv file, I'm often doing
> from scratch things like assigning labels to columns, mapping fields to
> the appropriate type, ignoring some fields, changing their order, etc.
> Before I go on and reinvent the wheel, is there a generic h
[0-9]" at the end. but this is optional
>
> can any one please help me out pls
>
>
> Teja.P
>
This is as general as could be constructed given your vague requirements:
"[a-zA-Z][a-zA-Z0-9_]+"
You may need to provide examples.
James
--
James Stroud
U
, something like this would be possible:
>
>
>>>>WeatherData.max_time
>>>>[0.01,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.10,0.11,0.12]
>
>
> Any help would be appreciated.
>
setattr(Weatherdata, "max_time", max_time)
--
James S
[EMAIL PROTECTED] wrote:
> James Stroud wrote:
>
>>[EMAIL PROTECTED] wrote:
>>
>>>I have a text file that I am parsing. Each line is of the form:
>>>
>>>max_time 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.10 0.11 0.12
>>>
>>>
nality. But, I'm curious about how people see such a beast
working, though. Please don't criticize unless you have a better idea
about the API of a Table. I want to hear genuine and concrete ideas and
not abstruse pontification about programming or design! Statements of "I
wouldn't do this thing here" should be immediately followed by
"--rather, I would do this other thing for which I've created a concrete
example below."
If you think this interface is genius, well my ego wants to hear about
that as well, but its not terribly necessary.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
Gerard Flanagan wrote:
>> py> # the following is probably the trickiest, should it return a Table
>> py> # should it be illegal?
>> py> # should t['Last'] be the way to take the "slice" and get the col?
>> py> t[None, 'Last'] # 1d slice returns list (2nd dim. explicit)
>> ['Barker', 'Burnet', '
RobJ wrote:
> Hi! My Name is Rob Johnson and I am a graduate student at The Richard
> Stockton College of NJ. To make a long story short, I'm working on my
> Masters project in the MAIT program (Masters of Arts in Instructional
> Technology). I have written a proposal to put together a free on-line
Gerard Flanagan wrote:
> What about symmetric 'load' and 'iterrows' methods for the Table class:
>
> t2 = Table()
> t2.load( t1.iterrows("LastName", "Age") )
>
> def load(self, iterable):
> '''expecting tuples'''
> for lname, age in iterable:
> self.append( lname, age )
>
[EMAIL PROTECTED] wrote:
> Hi, I have a list of strings. And I want to find the subset which
> matches a particular regular expression.
>
> import re
> ll = ('a', 'b', 's1', 's2', '3s')
> p = re.compile('^s.*')
> newList = filter(lambda s: p.match(s), ll)
>
> I suppose there should be simple func
Ernesto García García wrote:
> Hi experts,
>
> it's very common that I have a list and I want to print it with commas
> in between. How do I do this in an easy manner, whithout having the
> annoying comma in the end?
>
>
>
> list = [1,2,3,4,5,6]
>
> # the easy way
> for element in list:
>
ith
> tkFileDialog. Does someone have a solution for that?
import tkFileDialog
afile = tkFileDialog.askopenfile()
print afile.name
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
def adjust_attributes(self):
self.health += self._health_char_inc + self_health_base_inc
self.armor += self._armor_char_inc + self._armor_base_inc
# etc
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
is 'myjpegs'):
import binascii
import myjpegs
import cStringIO
def get_jpeg_as_opened_file(jpegname, module):
jpegascii = module.__dict__[jpegname]
jpegbin = binascii.a2b_base64(jpegascii)
return cStringIO.StringIO(jpegbin)
# getting that pik
get_jpeg_as_opened_file('coo
(tk, text='button')
py> b.tk
py> b.tk.call
> I have tried the following:
>
> self.table.bind("",self.table.tk.call(self.table._w,'yview','scroll',-5,'units')
I haven't used Table, but are you sure that what you are calling
&q
come from a java background, and that seems
> the only language I can pay the bills with:). Particularly in the US
> paid python jobs are hard to come by.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstrou
e it.
>
> Micah
>
Try urllib.
py> import urllib
py> astr = 'faf\tfasf dsf\ndsfds dsf dsaf \t\r'
py> urllib.quote(astr)
'faf%09fasf%20dsf%0Adsfds%20dsf%20dsaf%20%09%0D'
py> print astr
faf fasf dsf
dsfds dsf dsaf
James
--
James Stroud
UCLA-DOE
rom Tkinter import *
root = Tk()
def callback(e=None):
t = Toplevel()
Label(t, text='blah').pack()
b = Button(root, text='new top', command=callback)
b.pack()
root.mainloop()
Also, do not do this twice in the same script: Tk().
James
--
James Stroud
UCLA-DOE Institute
> windows. I have looked into the "takefocus" option, but doesn't seem
> to have any effect.
>
> I'm using Python 2.4 on Windows XP Pro SP1.
>
>
> Thanks
> Bernard
You should post a code snippet so we can see if there is anything amiss.
James
--
Jame
> appears 4/4.
>
> maybe have you some suggestions or idioms where i should look after
>
> best.
>
Look into suffix trees.
http://www.csse.monash.edu.au/~lloyd/tildeAlgDS/Tree/Suffix/
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
http://www.jamesstroud.com/
--
http://mail.python.org/mailman/listinfo/python-list
27;d']
>
> def generator():
> for char in alpha:
> for char2 in alpha2:
> for char3 in alpha3:
> yield char + char2 + char3
>
> x = generate()
> x.next() # etc, etc, etc,
>
import string
alpha = string.lowercase
def generator(choices, length):
fo
>
> def generator():
> for char in alpha:
> for char2 in alpha2:
> for char3 in alpha3:
> yield char + char2 + char3
>
> x = generate()
> x.next() # etc, etc, etc,
>
A touch more efficient:
import string
alpha = string.lowercase
def generator(c
7;]
>
> def generator():
> for char in alpha:
> for char2 in alpha2:
> for char3 in alpha3:
> yield char + char2 + char3
>
> x = generate()
> x.next() # etc, etc, etc,
>
Yet a little more efficient.
import string
alpha = string.lowercase
def gener
esn't do so well for something like
aaa
aab
.
.
.
zzy
zzzzzzz
James
SuperHik wrote:
> James Stroud wrote:
>
>> SuperHik wrote:
>>
>>> and the winner is... :D
>>> David Isaac wrote:
>>>
>>>> alpha = string.lowercase
>>>> x=(a+b+c for a in alpha for b in alpha for c in alpha)
>>>
>
Steve Holden wrote:
> James Stroud wrote:
>
>> Rob Cowie wrote:
>>
>>> Hi all,
>>>
>>> I wish to generate a sequence of the form 'aaa', 'aab', aac' 'aba',
>>> 'abb', 'abc' etc. all
201 - 300 of 1138 matches
Mail list logo