for item in function1(args):
object = class()
if (function2(item)):
if (condition):
object.variable = value
object.function()
print object # debug
print object #debug
The above pseudo code (not really, but close enough) is essentially
> Hmmm... you may want to modify the print statements slightly to make
> it more clear which of the two print statements are being displayed.
> As the code stands, it's not clear that 'condition' is ever set to true.
/me slaps himself in the forehead.
After modifying the print statements as s
-- Original Message -
Subject: Re: [Tutor] Numbers & Characters As Dictionary Keys
Date: Tue, 21 Jun 2005 17:47:41 +0100
From: "Alan G" <[EMAIL PROTECTED]>
To: "Don Parris" <[EMAIL PROTECTED]>,
"Python Tutor List"
>
tutor@python.org,
I'd like to invite you to try the new iMesh! iMesh 5 lets you search and download music, videos, images and more.
The Professional version is now FREE.
It's also 100% clean. NO POPUPS, NO SPYWARE and NO ADWARE.
iMesh 5 lets you con
Hello,
The attached code makes a number of colored rectangles visible
in a canvas. Each rectangle should match with a pre-recorded sound
file (in .wav or other format) containing the pronunciation of a
letter of the alphabet in a given language. For instance, the first
rectangle, in white,
> how do I set up scite editor with python so that I can click check
> syntax and compile from the editor?
You just need to setup your environment's PATH so that it knows where
to find python. This probably means you need to add "C:/python25" to
your path. Once you do this, restart scite, and it
What about It's an Editor based on wxPython. NewEdit uses Mixin and
Plugin technique as its architecture. Most of its classes can be
extended via mixin and plugin components, and finally become an
integrity class at creating the instance. So NewEdit is very dynamic.
You can write the new featur
I know that python has many packages such as nose, which is for
testing. Now I am going to test a quicktime file to find out if it
works properly. Are there an existing python package could do that? And
how to write the program?
Thanks,
Yi
___
Tutor mail
Andreas,
Thank you very much for your reply. "Using mplayer to test if the video
track decodes" sounds like a good idea. I am a new python user. Could
you please talk more details about how to do that.
Thanks again,
YiOn 11/1/06, Andreas Kostyrka <[EMAIL PROTECTED]> wrote:
Hello,
I bought the book "Python for Kids". started to read it, but can not
find where I have to install xturlte? I use macintosh... Have python
2.5.
If someone knows where I have to copy the xturtle and other files
(for xturle) on macintosh, will be happy for help:)
Thank You in advance,
V
I am learning Python and have written several small programs of increasing
complexity but so far they are all "linear" programs meaning that they are
meant to do one thing. I have yet to fully understand program control in
order to go to and return form modules (I think this is the correct term).
tions.
The term module may be incorrect here. I would like to have all of my code
in one program but be able to call sections of code and return from them to
the main app. That's where I'm lost.
On 2/8/07, Kent Johnson <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] wrote:
> I a
When I use the function random.randrange(x,y) I never get the upper limit y
in the list. I've tried the range 1,3 and never get 3. If I choose 1,4 I
get 3 but never 4. Is the upperlimit actually ___
Tutor maillist - Tutor@python.org
http://mail.pyt
Every example of a list that I've seen involves working with, sorting, etc
pre-populated list. How can I create a list where the user inputs a string
of numbers and then sorts it?
I've tried:
print "Input list separated by commas"
lst=[raw_input()]
print lst
print len(lst)
lst.sort()
print lst
I'm learning about creating classes and have created the simple class below:
class Temperature (object):
def fahrenheit(self):
return 32 + (1.8 * self.celsius)
d = Temperature()
d.celsius = float(input())
print d.fahrenheit()
This works fine stand-alone but I can't get it to wor
It's wxpython demo's code.
It's necessary to have the run.py in the same path, to make it run, and usually
also some other files.
--
Tom, http://www.vscripts.net
>
I've never heard of this module. Where did this code come from?
___
Tutor maillist -
Monty Python:
http://en.wikipedia.org/wiki/Monty_python
I believe full story is somewhere on python.org website.
--
Cheers, Tom
http://www.vscripts.net
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hello,
(Sorry if this message gets double posted)
I have been looking at using Beautifulsoup python module to make
changes to some static html files a total of 167 files, but being a
newb in programming was wondering first how to open, read/process the
file, then write it, close it and then ope
Hello,
I have been looking at using Beautifulsoup python module to make
changes to some static html files a total of 167 files, but being a
newb in programming was wondering first how to open, read/process the
file, then write it, close it and then open the next file thus creating
the loop.
Ca
Hi,
>From my previous post, I have tis so far:
[code]
import os
from BeautifulSoup import BeautifulSoup
rootdir='/home/david/test'
def upDateTable(line):
soup = BeautifulSoup(''.join(file))
return line
for subdir, dirs, files in os.walk(rootdir):
for file in files:
f=
ok, but looking at the docs isn't BeautifulStoneSoup an XML parser or am I
missing something?
David
Guard against online ID theft - http://www.tiscali.co.uk/spyguard___
Tutor maillist - Tutor@python.org
http://mail.python.org
Hi
Yes I did notice I don't pass anything in the upDateTable ;)
My problem is having to understand how to actually do this recursively
On the command line seems simple and I get:
>>> from BeautifulSoup import BeautifulSoup
>>> path = '/home/david/test/stack.html'
>>> path
'/home/david/test/stack.
Hello,
Thanks for the replies, I have now installed ipython and will take the
time to explore each object further.
But I have one more question.
On each page I have several
From $32.66
each with different price.
so, changing the code to use the findAll, returns a list:
>>> otp = soup.findAl
Yes I do need to learn the basics of programming ;)
This was the first I did, was to put the modification code into the
loop, but had this error:
>>> for x in otp:
... price = float(x.contents[1].lstrip(' $'))
... x.contents[1].replaceWith('$%0.2f' % (price * 0.85))
...
Traceback (most
OK I see,
>>> for x in otp:
... print x
...
From$23.60
$79.99
$39.99
1 Blister Pack - $65.95
So I will need to use the Remove elements in my code.
Thanks for all your help.
David
Guard your email - http://www.tiscali.co.uk/products/securemail/
_
Hello,
I am still fighting with parsing out the html text and this is what I
have so far, but seems I keep hitting my head against a barrier.
>>> import os
>>> from BeautifulSoup import BeautifulSoup
>>> file = '/home/david/test/stack.html'
>>> html = open(file, 'r')
>>> soup = BeautifulSoup(html
Hello
Sorry if this is a basic question, but how do I check if list is empty
or not and return True or False ;)
Thanks
David
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Thank you all for the replies.
the 'else' is this necessary, surely when you have an:
>>> if x:
... print 'x'
...print 'y'
is this correct?
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi,
Silly question but how do you use python's re module to find
dictionary items that contain the '$' symbol.
Thanks
David
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
thank you all.
__
New Online ID Theft Protection - http://www.tiscali.co.uk/spyguard
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi,
I would like to understand how to generate dictionaries based on other
dictionaries. For example, I have a 3 tables in ym SQL database -
Groups, Categories and Sub-categories with a one-to-many relations
between each.
I am presuming that each of these tables is one of my dictionaries?!?!
W
Hi,
Following Alan's post, what I was trying to do is to understand how I
can return the sub-item within the same space, if it makes sense ;)
For example, in my 3 one-to-many lists, I want to generate this list:
[{'id': ,
'category': [{'id': ,
'sub-c
Hello,
Thank you for the replies. I wanted to hold the data in memory,
because the number of records do not warrant the need to have to
maintain an additional relational database. Plus I wanted to understand
how to build this using classes as this will perhaps give me the bridge
I require to mo
Hey
My name is Tanya and i am new to python programmin. I have few questions which
hopefully will clear my doubts.
* First question, we are given a list
L = [ 345 , 32525 , 525 , 53245 , 6536 ]
how would i add them? like in this form - 3+4+5+3+2+5+.
* 2nd Question, we are
hello,
i have the follwoing csv file:
"Berat","Berat","Kuçovë","Skrapar"
"Dibër","Bulqizë","Dibër","Mat"
"Durrës","Durrës","Krujë"
"Elbasan","Elbasan","Gramsh","Librazhd","Peqin"
"Fier","Fier","Lushnjë","Mallakastër"
"Gjirokastër","Gjirokastër","Përmet","Tepelenë"
"Korçë","Devoll","Kolonjë","Korçë
Hello again,
Thanks for the replies on my previous post, but I have a different
problem now and don't see how to deal with it in a smooth way.
I have two csv files where:
1.csv
"1", "text", "aa"
"2", "text2", "something else"
"3", "text3", "something else"
2.csv
"text", "xx"
"text", "yy"
"tex
hello
silly question, but i can't seem to figure it it.
I have an object which is:
>>> type(price)
but i can't figure how to validate against it.
>>>if not isinstance(price, decimal.Decimal):
do something...
how do i ensure that the object 'price' is a decimal?
thanks
37 matches
Mail list logo