2009/2/10 David :
> Dear list,
>
> out of "Thinking in Python" I take the following code, which
> "takes a word and a string of required letters, and that returns True if
> the word uses all the required letters at least once".
>
>
> def uses_all(word, required):
>for letter in required:
>
2009/2/13 Ricardo Aráoz :
> There are a couple of utilities I want to be able to run from the
> command window. Now, if I'm at the command window, or Idle, or other non
> wx shell I want to establish a wx app. But if I'm in pythonWin, PyCrust,
> or any other wx based shell then there is a wx event
2009/2/13 Eric Dorsey :
> Alan, can you give a short snippet of what that would look like? I was
> trying to code out some idea of how you'd retain insertion order using
> another dict or a list and didn't get anywhere.
Here's something basic:
class o_dict(dict):
def __init__(self, *args, **
2009/2/16 Alan Gauld :
> for index, item in [9,8,7,6]:
> print index, item
>
>
> 0 9
> 1 8
> 2 7
> 3 6
You mean:
for index, item in enumerate([9,8,7,6]):
print index, item
:-)
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/
2009/2/19 pa yo :
> I am running my Twitter>>Wiki bots in infinite loops but can't find
> an easy way to turn them off gracefully once I have started them. At
> the moment I have to go into the terminal window where they are
> running and type "Ctrl-C". (I am running Ubuntu 8.10 and python 2.5.2)
2009/2/27 prasad rao :
> Hello
> I don't know why, but this I think going into infinite loop.
> I cant see anything wrong in it.
> Please show me where the problem is.
[...]
> while len(line)>60:
> tem=line[60:]
> try:
> ??? a,b=tem.split(' ',1)
> ?
2009/3/3 Judith Flores :
>
> Hello,
>
> I can't seem to figure out the syntax to calculate the difference in
> minutes between two time stamps. I already read the documentation about
> datetime and time modules, but I was unable to implement the code.
>
> My code will be fed with two timestamps
2009/3/3 Wayne Watson :
> What is this: d = [ int(x) for x in s.split(":") ]
It's a list comprehension:
http://docs.python.org/tutorial/datastructures.html#list-comprehensions
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mail
2009/3/9 WM. :
> File "C:\Python26\TicTacToeD.py", line 68, in DisplayBoard
> print "\n\t", board[1], "|", board[2], "|", board[3]
> TypeError: 'function' object is unsubscriptable
>
> I am fooling around with Dawson's "...for the Absolute Beginner". The
> tic-tac-toe program will not run for m
2009/3/9 WM. :
> Thank you for your remarks. Too bad they fell into my acres of ignorance.
> One thing is certain, Dawson used brackets [] not parens (). When I spoke of
> typi (plural of typo) I meant ; for : or \ for /, not line after line of
> error.
> My only alternative now seems to be 'get ou
2009/3/18 Wayne Watson :
> Unfortunately, that takes me back to the original situation. That is, the
> blank window appears along with the dialog window. It also ends badly with
> what looks like the same error messages(below). Maybe focus needs to be
> established. I'm really using this code to de
2009/3/18 Wayne Watson :
> Not at all. I took Grayson's example as it stood. However, as it might have
> been noted above, he was working with Pmw, so the code may be a false
> impression of how it works in Tkinter.
>
> This gave the same results:
> root = Tk()
> dialog = DialogPrototype(root)
> ro
2009/3/19 Alexander Daychilde (Gmail) :
> That creates a list of numbers. I also need to do letters. That is, treat
> a-z as base 26, and do the same thing. The three examples I gave from before
> would be:
> 1:9 --> a:z
> 1:99 --> a:zz
> 01:99 -- no "zero" in alpha to worry ab
2009/3/20 andré palma :
> Hi \o
> I'm asking if there is any #include( C) like or any include('File.php')
> (php) like in python.
> I have 2 files: "usbconnection.py" and "listen.py", And i want to use some
> classes avaiable in "listen.py" on my main file "usbconnection.py". I've
> tryed to do __i
2009/3/30 Chris Castillo :
> that is what I have so far but I need to create a condition where I need
> only 10 sufficient numbers from the variable decnum2. I know I need
> something like
> if len(decnum2) > 11:
> decnum2 = decnum2[0:11]
Perhaps the round() function will help?
>>> round(1234
2009/3/30 Chris Castillo :
> yeah that function would help but how would I join both sides again to get a
> decimal real(float) to round?
>
> for example myfloat = decnum1, ".", decnum2 doesn't work because the string
> "." isn't a valid int type. how would I join those to be a float again?
The ea
2009/3/31 james carnell :
> for row in range(25,31,1):
> for col in range(10,12, 0.3): #<- Crash Bang doesn't work 0.3 = zero =
> infinite loop?
> [...]
> is there no way to do it with a range function (and have it still look like
> you're not on crack)?
Well, you could do this:
>>> [float(x
2009/5/12 nickel flipper :
> sfr (key=PORTA addr=0xf80 size=1 access='rw rw rw u rw rw rw rw')
> reset (por='' mclr='')
> bit (names='RA7 RA6 RA5 - RA3 RA2 RA1 RA0' width='1 1 1 1 1 1 1 1')
> bit (tag=scl names='RA' width='8')
> bit (names='OSC1 OSC2 AN4 - AN3 AN2 AN1 AN
2009/5/22 Eduardo Vieira :
> I will be looking for lines like these:
> Lesson Text: Acts 5:15-20, 25; 10:12; John 3:16; Psalm 23
>
> So, references in different chapters are separated by a semicolon. My
> main challenge would be make the program guess that 10:12 refers to
> the previous book. 15-20
2009/5/26 Eduardo Vieira :
> Now, a little farther on the topic of a Bible database. I'm not sure
> how I should proceed. I don't really have the db file I need, I will
> have to generate it somehow, from a bible software, because the
> version I want is for Portuguese. I have found a bible in sql,
2009/6/12 acfleck :
> I'm a Python nubie and having trouble with 3.0.1 on Mac (10.4.11). I did a
> default install of MacPython 3.0.1. The IDLE.app works fine, but from a
> Terminal window, the 'python' command still gets me V2.5.3 (the original
> Apple installed version). A 'python3' command is no
2009/6/13 Eddie :
> Hi guys,
>
> What would you regard as the best free Python editor to use on Windows
> for a new guy? Searching Google i see that there is quite a few out
> there and is "VIM" the best one to go with?
Vim is a general purpose programmer's editor with python support,
rather than
2009/6/23 Alan Gauld :
> Interesting! How is a NaN stored in Python?
> ie. How do you get to the point of having one in the first place?
Well, you can do this:
>>> float('nan')
nan
(try float('inf') too)
--
John.
___
Tutor maillist - Tutor@python.o
2009/11/20 :
> Hey Gang,
>
> Can a function/method be added to a dictionary like so:
>
> myDictionary = {"string":processString(parameter),
> "string2":processString2(parameter),
> "string3":processString3(parameter)
> }
>
> I am basically interested in
Guillermo Fernandez Castellanos wrote:
Is there any "table" frame that I am unaware of? or a way of changing
the type of character so I can have a font with characters of equal
width?
You might see if this does what you want:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52266
--
John.
Guillermo Fernandez Castellanos wrote:
The thing is, pmw does not seem to have ExFileSelectDialog. Any hint
about how I could substitute this lack?
Does ExFileSelectDialog do anything that the standard Tk file dialogs don't?
(if you don't know about it: have a look at the tkFileDialog module)
--
Jo
Michael Powe wrote:
Here's an example: in Java, I wrote an
application to track my travelling expenses (I'm a consultant; this
tracking of expenses is the itch I am constantly scratching. ;-)
I've also written this application in a perl/CGI web application as
well.) It's easy to see the outline
Andrzej Kolinski wrote:
I would like to go even further and employ Tkinter to:
- open and run a C and/or Python code (including arguments where
necessary),
- name and save generated html/php files.
The only thing I found is the following line of code:
filemenu.add_command(label="Open...", command
Jeff Shannon wrote:
You might want to check the Cookbook to see if there's a priority
queue recipe there. If not, I suspect that Google can be convinced to
yield something...
From the bisect module docs:
import Queue, bisect
class PriorityQueue(Queue.Queue):
def _put(self, item):
bisec
Ryan Davis wrote:
I think map is a little cleaner is some cases. Not sure if its more Pythonic,
I'm still trying to figure out exactly what that
means.
map is (probably) going to be removed in Python3000 :-( So it's
probably better to not get into the habit of using it.
--
John.
__
Diana Hawksworth wrote:
Hi! I need help on blocking user access to a message box - for example,
the program could provide an answer to an input. At the moment, the
user has access to - and can type into - that "answer" space. How do I
prevent that from happening please?
Are you using Tkinter?
David Holland wrote:
Is there any material anyone knows about how to use
pure python without pygame to write games ? The
reason for asking, is that although pygame is good it
has the disadvantage of that your users must have
pygame. It is also harder to create a stand alone
.exe with python ?
Why
Kent Johnson wrote:
jrlen balane wrote:
basically, i'm going to create a list with 96 members but with only
one value:
is there a shorter way to write this one???
[1] * 96
Just a note on this ---
This will work fine for immutable types (such as integers or strings).
But you can get into trouble i
Richard Lyons wrote:
I have little experience with programming. I have Python installed on a
Windows XP system. What code do I need to use to send output from a
Python script to a local printer attached to my workstation? to a
network printer?
The win32print module (in Matt Hammond's windows
John Carmona wrote:
I have going through Josh Cogliati tutorial, I am stuck on one of the
exercise. I need to rewrite the high_low.py program (see below) to use
the last two digits of time at that moment to be the "random number".
This is using the import time module.
If you look at the docs for
Andrei wrote:
Liam Clarke wrote on Sat, 2 Apr 2005 22:12:49 +1200:
I know that as above doesn't work, but was just wondering if it's
possible, and if it's a Bad Thing?
Max has already shown it's possible. Whether it's a Bad Thing... I don't
see why it would be. But I also can't imagine right now an
Kevin Reeder wrote:
This is not my code but is taken from the book I'm working with. My
problem is that whenever I call to the __add__ method the counters
increase by 2 while calls the __len__ method increase the counters
by 1 as expected.
Well, I can't duplicate your results.. I get the behaviou
Andrei wrote:
Recursion is dangerous if its depth is unchecked. I've recently seen a recursive
quicksort implementation run wild for example, killing the program without any
error message (not in Python, but the principle is the same regardless the
programming language).
I recall an assignment I on
Gooch, John wrote:
> Is there a way to create multiple __init__ routines in a Python Class?
Not directly (well, not that I know of). But you can always emulate it.
eg:
class Foo(object):
def __init__(self, init, *args, **kw):
if init == 'this':
self._initThis(*args, **kw)
elif ini
Luke Jordan wrote:
> I have several frighteningly cumbersome reports to review at my new
> job. I would like to write a python program to help me with my
> analysis. The goal of the program is to filter out information that
> doesn't meet certain requirements and print relevant results back to
> a
On 26/04/07, Terry Carroll <[EMAIL PROTECTED]> wrote:
> I have a list (of arbitrary length) of lists, each sublist having a fixed
> number N of items, all integers.
>
> I would like to produce a list of N items, each item of which is an
> integer which is the average of the elements in the same pos
On 27/04/07, Shuai Jiang (Runiteking1) <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> The program that I am working on right now have a template for string
> formatting.
> My question is that is it possible to use multiple dictionary to format the
> string.
>
> For example
> x = {'foo':1234, 'bar
On 02/05/07, John Washakie <[EMAIL PROTECTED]> wrote:
> It aint pretty! And if I had just walked away, it probably would've
> taken half the time in the morning, but here's what I've come up with
> (any suggestions for improvements, or course are welcome):
I'm still not sure exactly what you want
On 04/05/07, Teresa Stanton <[EMAIL PROTECTED]> wrote:
> the image and moves it. I should mention that I've tried 'move() and
> coord()' to get the object to move, but I am not getting the effect I want.
> When I use move in successive steps it just appears at the last move
> coordinates.
My Tkin
On 08/05/07, Teresa Stanton <[EMAIL PROTECTED]> wrote:
> I seem to be stuck again. I've attached my entire file (and the .gif I'm
> using. My son made this .gif, its our lab). The problem is my xp (the
> variable I use for my x coordinate) isn't updating after the .gif moves. I
> think I should
On 09/05/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> try:
> print "The fridge contains %s" %fridge[food_sought]
> except (KeyError):
> print "The fridge does not contain %s"%food_sought
[...]
> Is the same true of Python? Or is ok to use Exception handling like the book
> suggests?
On 11/05/07, Jeff Peery <[EMAIL PROTECTED]> wrote:
> hello, I was wondering what might be the best way to structure my data
> within python. I am sampling data points, and in each there is a time,
> value, and text string associated with that sample. so I was thinking I'd
> make a list of 'measurem
On 11/05/07, Jeff Peery <[EMAIL PROTECTED]> wrote:
> ok, thanks. so is there a difference in performance if I do it this way
> versus if I use say a numpy function on an array? thanks.
I don't know enough about numpy to answer your quesiton, but you may
be able to answer it yourself: check out the
On 13/05/07, Marilyn Davis <[EMAIL PROTECTED]> wrote:
> #!/usr/bin/env python
> '''An Under10 class, just to fiddle with inheriting from int.'''
>
> class Under10(int):
>
> def __init__(self, number):
> number %= 10
> int.__init__(self, number)
Subclassing int and other types i
On 14/05/07, Alan <[EMAIL PROTECTED]> wrote:
> I'm looking for a more elegant way to parse sections of text files that
> are bordered by BEGIN/END delimiting phrases, like this:
>
> some text
> some more text
> BEGIN_INTERESTING_BIT
> someline1
> someline2
> someline3
> END_INTERESTING_BIT
> more t
On 15/05/07, Arthur Coleman <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I believe it should be if !(year % 4) or !(year % 100) or !(year % 400)
FWIW, the correct leapyear test is:
if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
# then year is a leap year
Year 2100 will not be a leap ye
On 22/05/07, John Washakie <[EMAIL PROTECTED]> wrote:
> I have a Dictionary, that is made up of keys which are email
> addresses, and values which are a list of firstname, lastnamet,
> address, etc...
>
> If I run the following:
>
> last = {}
[...]
> for k,v in last:
> print "Email: %s , ha
Check out the math module.
On 28/05/07, adam urbas <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I was just wondering how I would go about performing a square root thing,
> for my radiacir.py program.
>
>
> Create the ultimate e-mail address book. Import your contacts
On 07/06/07, Brad Tompkins <[EMAIL PROTECTED]> wrote:
> Is there a way to make use of multi-line comments when programming using
> python? Having to stick a # in front of every line gets pretty tedious when
> I want to make a comment more detailed than I normally would.
>
> If there isn't a way, c
On 14/06/07, Stephen McInerney <[EMAIL PROTECTED]> wrote:
> Where is there a table of replacements for the deprecated 'string' fns
> esp. the basic common ones e.g. string.split(), join(), replace(), find(),
> index() ?
> http://docs.python.org/lib/node42.html
They've basically all moved into the
On 14/06/07, Jacob S. <[EMAIL PROTECTED]> wrote:
> Hi guys.
> I was just wondering what's going to happen to capwords and maketrans
> when the string module is finally terminated.
As far as I know, the string module as a whole is not going away. In
particular, the string module supplies vario
On 17/06/07, Iyer <[EMAIL PROTECTED]> wrote:
>
> say, if I have a list l = [1,2,3,5]
>
> and another tuple t = ('r', 'g', 'b')
>
> Suppose I iterate over list l, and t at the same time, if I use the zip
> function as in zip(l,t) , I will not be able to cover elements 3 and 5 in
> list l
>
> >>> l =
On 20/06/07, Norman Khine <[EMAIL PROTECTED]> wrote:
> My question is how to get all the words in the string to start with
> capital letter?
Hmm, well the title() function is a new one to me :-)
More generally, if we have raw = 'one two three', then I would have
done it using raw.split(). i.e.
On 22/06/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I created a shelf called 'myshelf' and put two objects in it, a string and a
> list. When I open the shelf I get:
>
> >>> d=shelve.open('/Users/development/Desktop/myshelf')
> >>> d.keys()
> ['dir1', 'dir2']
> >>> d
> {'dir2': '/Users/dev
On 26/06/07, Terry Carroll <[EMAIL PROTECTED]> wrote:
>
> Is there any way of getting to the schema of an sqlite database from
> within Python? In particular, a list of tables in the DB.
Try 'select * from sqlite_master'.
--
John.
___
Tutor maillist -
On 29/06/07, Iyer <[EMAIL PROTECTED]> wrote:
> I have 2 lists:
>
> List 1 has lists in it, such as
>
> list1 = [[1,'A'],[2,'B'],[3,'C'],[4,'D']]
>
> There is another list2 such as
>
> list2 = [[1,'AA'],[3,'CC'], [4,'DD']]
>
> For eg,
>
> I wish to iterate over both the lists and produce the output
On 02/07/07, Alan Gauld <[EMAIL PROTECTED]> wrote:
>
> "elis aeris" <[EMAIL PROTECTED]> wrote
>
> >> In [4]:import array
> >> In [5]:def f7(list):
> >>.5.: return array.array('B', list).tostring()
> >>.5.:
> >>
> >> In [6]:f7([97, 98, 99])
> >> Out[6]:'abc'
> I can't remember which tool do
On 05/07/07, Sara Johnson <[EMAIL PROTECTED]> wrote:
> This may sound silly, but when writing a program where there is a pickle
> file, how does that get included into the entire program? For instance;
Hi Sara,
You create pickles with pickle.dump and you read them with pickle.load.
For example:
On 06/07/07, Richard Querin <[EMAIL PROTECTED]> wrote:
> I'm writing a very simple python script which writes out some
> predefined text to a file (which will later become part of an html
> file). I need to write out a pound sign '#' to the file and I can't
> figure out how to escape it. I've tried
On 10/07/07, elis aeris <[EMAIL PROTECTED]> wrote:
> from the document i know that if I want to open a text file I do:
>
> f = open("text.txt", "r+")
>
> and thus create f as an file object i can then use.
>
> however, i don't understand these functions
>
> .readline
> .readlines
> .read
> .xlinesr
On 10/07/07, bhaaluu <[EMAIL PROTECTED]> wrote:
> >>> file.readlines()
> Traceback (most recent call last):
> File "", line 1, in ?
> AttributeError: 'str' object has no attribute 'readlines'
This error here is caused by this earlier statement:
> >>> file=open('text.txt').read()
'file' is now
On 11/07/07, Brian Hicks <[EMAIL PROTECTED]> wrote:
> Hi, I'm making a webcam automation script (for a project 365 photo thing)
> and I can't figure out how to increment the filename every time the script
> saves an image. I'm using this snippet of code to count the tiles in the
> directory:
[...
On 13/07/07, Dave Kuhlman <[EMAIL PROTECTED]> wrote:
> And, I have a question -- If you look at the example of the
> iterative (non-recursive) generator (the Doubler class), you will
> see that it walks a list, not a tree. That's because I was *not*
> able to figure out how to implement a non-recu
On 13/07/07, encore jane <[EMAIL PROTECTED]> wrote:
> Does anyone know about a good native Excel file reader that is platform
> independent?
I have had success with pyExcelerator:
http://sourceforge.net/projects/pyexcelerator
--
John.
___
Tutor maillis
On 15/07/07, max baseman <[EMAIL PROTECTED]> wrote:
> im writing a quick quote reader that spits out a random quote from a
> show but cant get it to pick randomly
> i tried
> a=randrange(820)+1
> text.readline(a)
>
> and i would prefer not having to bring evryline into the program then
> picking li
On 26/07/07, Luke Paireepinart <[EMAIL PROTECTED]> wrote:
> Wow, it was actually quite a bit harder to Google than I thought :)
> well, some experimentation leads me to believe this is the syntax for
> list slicing:
[...]
It's in the docs, albeit rather tersely:
http://www.python.org/doc/current/l
On 31/07/07, Iyer <[EMAIL PROTECTED]> wrote:
> os.path.exists("c:/winnt/file_name")
>
> Nope, even, with the use of forward slashes in the path, it still returns
> false
>
> What am I doing wrong here ?
Type 'os.listdir("c:/winnt")' and see what it gives you. I haven't
looked at the code, but I
On 31/07/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> is there a way for me to create a class that accepts a dictionary of
> submitted data and uses each key ad value to create a corresponding member
> variable ? The current way I do this is with a very long argument list, and
> line by line
On 01/08/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> John, I spent the last two hours trying to understand what you wrote, and I
> feel I'm missing something:
>
> >>> a_dict = {'one':1, 'two':2, 'three':3}
> >>> class A(object):
> def __init__(self, **kwargs):
> for var in kw
I'm not sure about PRAGMA, but you can do introspection in sqlite by
examining the table 'sqlite_master'.
--
John.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On 03/08/07, Terry Carroll <[EMAIL PROTECTED]> wrote:
> On Thu, 2 Aug 2007, John Fouhy wrote:
>
> > I'm not sure about PRAGMA, but you can do introspection in sqlite by
> > examining the table 'sqlite_master'.
>
> Thanks. That's how I get the
On 08/08/07, Tim Finley <[EMAIL PROTECTED]> wrote:
> I'm a newbie to programming and am trying to learn Python. Maybe I'm wrong,
> but I thought a practical way of learning it would be to create a script. I
> want to automate the gathering of mailbox statistics for users in a post
> office. Ther
Really? What are you having trouble with? I have used pyexcelerator
under Windows without problems.
--
John.
On 16/08/07, Kirk Bailey <[EMAIL PROTECTED]> wrote:
> looks good. works bad; this is a windows workplace. ouch. Advice please
> (other than change operating systems)?
&g
On 16/08/07, Dick Moores <[EMAIL PROTECTED]> wrote:
> Python sees 1,987,077,234,456 as a tuple:
> >>>type(1,987,077,234,456)
>
Hmm, not for me:
>>> type(1,987,077,234,456)
Traceback (most recent call last):
File "", line 1, in
TypeError: type() takes 1 or 3 arguments
What python are you usi
On 16/08/07, Dick Moores <[EMAIL PROTECTED]> wrote:
> That's cool! However, it doesn't solve the problem in my original post.
>
> >>> t = 1,987,087,234,456
>File "", line 1
> t = 1,987,087,234,456
> ^
> SyntaxError: invalid token
Hmm, yes. Any integer starting with a 0
On 16/08/07, Dick Moores <[EMAIL PROTECTED]> wrote:
> What's that asterisk doing in decomma(*t)? Where do I go in the docs
> to look it up?
You can find it in the tutorial:
http://docs.python.org/tut/node6.html#SECTION00674
Or see my post here:
http://mail.python.org/pipermail/tut
On 20/08/07, Johnny Jelinek IV <[EMAIL PROTECTED]> wrote:
> I was wondering if something like this is possible; Can I create a python
> script that will connect to a website to use it's search features to gather
> information for me? For example, if I wanted information about a movie from
> imdb,
On 23/08/07, R. Alan Monroe <[EMAIL PROTECTED]> wrote:
> I wrote a lame, but working script to solve this in a few minutes. A
> fun puzzle.
>
> http://weblogs.asp.net/jgalloway/archive/2006/11/08/Code-Puzzle-_2300_1-_2D00_-What-numbers-under-one-million-are-divisible-by-their-reverse_3F00_.aspx
>>
On 23/08/07, Ian Witham <[EMAIL PROTECTED]> wrote:
> An interesting sequence! I assumed the next two numbers would be 8799912,
> 9899901
Hmm...
http://www.research.att.com/~njas/sequences/?q=8712%2C+9801%2C+87912%2C+98901%2C+879912%2C+989901&language=english&go=Search
http://mathworld.wolfram.com
On 27/08/07, Michael <[EMAIL PROTECTED]> wrote:
> I am fairly new to Python and I wish to validate input. Such as wanting
> to check and make sure that an integer is entered and the program not
> crashing when a naughty user enters a character instead. I have been
> trying to use the Type() functio
On 28/08/07, Che M <[EMAIL PROTECTED]> wrote:
> Hi, I am curious about ways in Python to approach the idea of "tagging"
> pieces of information much in the way that one can tag favorite websites
> like on the site Del.icio.us. I'm not sure if tagging is the best term for
> this (due to confusion w
On 29/08/07, Trey Keown <[EMAIL PROTECTED]> wrote:
> attrs={u'title': u'example window title', u'name': u'SELF', u'icon':
> u'e.ico'}
> keys = ['name','title','icon']
> for (tag, val) in attrs.iteritems():
> for key in keys:
> print val
>
> the first "for" tag causes the dictionary (att
On 11/09/2007, Ashley Booth <[EMAIL PROTECTED]> wrote:
> I am trying to create a script that will get files from a directory
> that the user specifies, then feeds the relevant input and output
> (which are input and output paths) into another python script whose
> path is also given by the user. I'
On 11/09/2007, max baseman <[EMAIL PROTECTED]> wrote:
> basically the problem is to find a bunch of ways to put 1,2,3,4,5
> into different math problems to that equal 1-25, i haven't spent to
> much time thinking about how to do this but i cant think of a way to
> do it it without writing making th
I'm not sure I understnad your quesiton..
You can put classes into lists, dictionaries, et cetera. For example:
##
class Foo(object):
pass
class Bar(object):
pass
class Baz(object):
pass
my_classes = { 'foo':Foo, 'bar':Bar, 'baz':Baz }
thing = my_classes['bar']()
##
It seems qui
On 14/09/2007, Rikard Bosnjakovic <[EMAIL PROTECTED]> wrote:
> On 14/09/2007, Terry Carroll <[EMAIL PROTECTED]> wrote:
> > The second one, which just checks "if x" and is satisfied with any false
> > value, including an empty tuple, does not raise the error condition, even
> > though the data is ba
On 17/09/2007, Ara Kooser <[EMAIL PROTECTED]> wrote:
> Give certain conditions I want the yeast cell to die. Kent suggested I
> use something this:
> yeasts = [yeast for yeast in yeasts if yeast.isAlive()] to clear out
> dead yeast.
[...]
> class Yeast:
[...]
> def isAlive(self):
> if
On 18/09/2007, Andrew Nelsen <[EMAIL PROTECTED]> wrote:
> I was wondering, recently, the most expedient way to take a string with
> [EMAIL PROTECTED]&*] and alpha-numeric characters [ie. "[EMAIL
> PROTECTED]@*$g@)$&^@&^$F"] and
> place all of the letters in a string or list. I thought there could
You've got upper and lower bounds - maybe you could do a binary search
to find the max exactly? It should only take the same number of steps
again...
On 9/25/07, Terry Carroll <[EMAIL PROTECTED]> wrote:
> On Mon, 24 Sep 2007, Christopher Spears wrote:
>
> > How can I find the largest float and com
On 02/10/2007, Suzanne Peel <[EMAIL PROTECTED]> wrote:
> I am trying to find the name of the file I am currently running (please
> don't laugh at me I know it's simple but I cannot figure it out).
Have a look at sys.argv[0] :-)
--
John.
___
Tutor mai
On 02/10/2007, GTXY20 <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> Let's say I have the following dictionary:
>
> {1:(a,b,c), 2:(a,c), 3:(b,c), 4:(a,d)}
>
> I also have another dictionary for new value association:
>
> {a:1, b:2, c:3}
>
> How should I approach if I want to modify the first dictionar
On 04/10/2007, Christopher Spears <[EMAIL PROTECTED]> wrote:
> Obviously, I can just create a pattern "\d+ \w+ \w+".
> However, the pattern would be useless if I had a
> street name like 3120 De la Cruz Boulevard. Any
> hints?
Possibly you could create a list of street types ('Street', 'Road',
'C
On 09/10/2007, Dick Moores <[EMAIL PROTECTED]> wrote:
> What's the best way to get hours in 2 or more digits, and minutes in
> 2 digits, so that the above would be 05:07:36.88? (I'm writing a stopwatch.)
String formatting!
>>> template = '%02d:%02d:%02d.%02d'
>>> template % (1, 22, 3, 44)
'01:22:
On 09/10/2007, Chuk Goodin <[EMAIL PROTECTED]> wrote:
> I've got a bit of code here that's giving me some trouble. I am trying
> to make a 2 dimensional array with nested lists, but when I try to
> change one element, it changes all the elements in that "column".
>
> I'm trying to get it to make on
On 10/10/2007, Eli Brosh <[EMAIL PROTECTED]> wrote:
>
>
> Hello
> I have a multiline string such as:
> s='''This is the first line
> This is the second line
> This is the third longer line'''
>
> Note that s has no control character such as \n.
Did you check that?
>>> s = '''This is the first lin
1 - 100 of 503 matches
Mail list logo