From: chris Hynes cjhyne...@hotmail.com
Date: 2009/7/15
Subject: The why
To: roadier...@googlemail.com
Well, I'm trying to create an interactive program, let's say I'm
running the program, I ask the user to give the array a name, I then
do some computations and store the results in that
Date: Thu, 9 Jul 2009 04:12:55 +0100
From: Rich Lovely roadier...@googlemail.com
Message-ID:
f0b4202b0907082012q3bafb59ev6fd76495326f3...@mail.gmail.com
Natural language parsers are one of the hardest things to create.
I think the most famous illustration of this is the problem of
parsing
Angus Rodgers ang...@bigfoot.com wrote
parsing these two sentences:
Time flies like an arrow.
Fruit flies like a banana.
Or the translation program that translated the expression
Out of sight, out of mind
from English to Russian and back with the result:
Invisible, lunatic
Alan G.
2009/7/9 Pete Froslie fros...@gmail.com:
-- Forwarded message --
From: Pete Froslie fros...@gmail.com
Date: Wed, Jul 8, 2009 at 8:53 PM
Subject: Re: [Tutor] thesaurus
To: Robert Berman berma...@cfl.rr.com
Thanks Robert,
I will try this out.. at the moment I'm playing
Great Richard, thanks..
I'm getting an error as follows:
from __future__ import with_statement
SyntaxError: from __future__ imports must occur at the beginning of the file
I don't think this is the issue in need of rework and have tried a few quick
reworks.. I'll read up a bit on 'with'
cheers
2009/7/9 Pete Froslie fros...@gmail.com:
Great Richard, thanks..
I'm getting an error as follows:
from __future__ import with_statement
SyntaxError: from __future__ imports must occur at the beginning of the file
I don't think this is the issue in need of rework and have tried a few quick
No problem, thanks for taking the time.
I'm actually trying to resolve this error now:
buff.append( .join(lookup(Word) for Word in line.split()))
NameError: global name 'lookup' is not defined
..also assume I need to change 'Word' to something that checks the next word
in the text file and
2009/7/9 Pete Froslie fros...@gmail.com:
No problem, thanks for taking the time.
I'm actually trying to resolve this error now:
buff.append( .join(lookup(Word) for Word in line.split()))
NameError: global name 'lookup' is not defined
..also assume I need to change 'Word' to something
I see.. that makes sense. Kind of new with python -- sorry for that.
after printing using this:
print urllib.urlopen('
http://words.bighugelabs.com/api/2/e413f24801aa30b8d441ca43a64317be/moving/').read(
)
I'm getting a format like this returned:
adjective|sim|streaming
adjective|sim|swirling
oops.. I just realized I attached the wrong example for the API-- it was off
by number, this one works:
print urllib.urlopen('
http://words.bighugelabs.com/api/2/e413f24701aa30b8d441ca43a64317be/moving/').read(
)
The example makes sense to me and I can see how it is difficult to figure
out a
2009/7/9 Pete Froslie fros...@gmail.com:
I see.. that makes sense. Kind of new with python -- sorry for that.
after printing using this:
print
urllib.urlopen('http://words.bighugelabs.com/api/2/e413f24801aa30b8d441ca43a64317be/moving/').read()
I'm getting a format like this returned:
On Wed, Jun 24, 2009 at 6:16 PM, Richard
Lovelyroadier...@googlemail.com wrote:
(oops... forgot to reply-all)
-- Forwarded message --
From: Richard Lovely roadier...@googlemail.com
Date: 2009/6/25
Subject: Re: [Tutor] Problems with parameter queries
To: Eduardo Vieira
def get(numbers):
print 'Calling ', numbers
sleep(1)
print 'Connected '
sleep(1)
def call_numbers():
for i in range(9549355543, 9549355560):
numbers = i
get(numbers)
call_numbers()
Is there a technical name for a loop like this?
For loop? That is what I
David wrote:
Subject:
Re: [Tutor] Find files without __doc__ strings
From:
David da...@abbottdavid.com
Date:
Mon, 18 May 2009 14:02:38 -0400
CC:
tutor@python.org
Lie Ryan wrote:
David wrote:
spir wrote:
Le Sat, 16
Dave
Slashes in linux indicate a directory path. You use them when trying to specify
paths. You can also use them to specify a path to a file.
Sent from my Verizon Wireless BlackBerry
-Original Message-
From: David da...@abbottdavid.com
Date: Tue, 12 May 2009 20:07:10
To:
On Sat, Jan 24, 2009 at 10:36 AM, Vicent vgi...@gmail.com wrote:
But this is not nice:
type(a)
type 'bool'
a
True
a = 0
type(a)
type 'int'
I mean, being a a boolean variable, it works as if it was a number, but
every time I want to update the value of a, I must put False for 0 and
Thx for help,
extreme lack of free time lately,
will look into it.
[Wouldn't've noticed myself that urlopen is not a class.]
On Tue, Dec 23, 2008 at 6:03 PM, Richard Lovely
roadier...@googlemail.comwrote:
OK, going on Kent's post:
from urllib import urlopen
class fetch(object):
def
On Tue, Dec 23, 2008 at 9:31 AM, Omer jaggojaggo...@gmail.com wrote:
from urllib import urlopen
class fetch(urlopen):
... def __init__(self,*args):
... urlopen.__init__(self, *args)
... self.content = self.read()
...
Traceback (most recent call last):
File
OK, going on Kent's post:
from urllib import urlopen
class fetch(object):
def __init__(self, *args):
self.response = urlopen(*args)
self.content = self.response.read()
I forgot urlopen was a function. It made sense in my head for it to
be a class, instead of _returning_ a
With the amount of information provided so far, I'd say you need to step
back and question your initial assumptions. Python shouldn't have a
great deal of trouble reading variable-length binary data blocks, and
the overhead of doing that is probably a lot less than it would be to
have another
so using this, if num ==6, then i should get 2 and 88 ?
thanks, just checking to make sure i get what you wrote.
shawn
On Mon, Oct 20, 2008 at 11:00 AM, Luke Paireepinart
[EMAIL PROTECTED] wrote:
-- Forwarded message --
From: Luke Paireepinart [EMAIL PROTECTED]
Date: Mon, Oct
jeez, i screwed up, i ment num = 600, not 6
thanks
On Mon, Oct 20, 2008 at 11:16 AM, Luke Paireepinart
[EMAIL PROTECTED] wrote:
No, I'm not sure what you mean.
Given this number
100101010101101011
the operation will slice off bits on the left with the % 2**16 so that
we only have 16 bits,
thanks, Luke,
got me started anyway.
shawn
On Mon, Oct 20, 2008 at 11:23 AM, Luke Paireepinart
[EMAIL PROTECTED] wrote:
I'm not sure if those values are correct; I can check later tonight,
but I'm doing some statechart diagrams for class right now. They
sound reasonable but I can't be sure.
No, I'm not sure what you mean.
Given this number
100101010101101011
the operation will slice off bits on the left with the % 2**16 so that
we only have 16 bits,
0101010101101011
then it will shift this value to the right so that we only have the
highest 8 bits
01010101
that will be stored in
high, low = ((num % 2**16) 8, num % 2**8) or something thereabouts.
My take would be something like
high, low = (num 8) 0xff , num 0xff
In case you want another option. This is probably more
efficient since you're not raising to powers or taking the
modulus, although for all I know
Title: Signature.html
I've done far worse by hitting the wrong key! ;-) I see a post above
gets into the class idea.
Jaggo wrote:
Silly google sent in the middle of my editing. Good
thing it only sent to you then. Please, ignore these 2 messages. Sorry
'bout the mess.
--
if pitch == csharp:
runmyprogram(now)
Yep, that is something what I'm looking for. And maybe with some other
thing than pitch too (don't know what you can get from a sound file).
But I looked at most of the examples of the modules and couldn't find
anything like this.
W W schreef:
The point of a lot of these challenges is to be smart with your math as well
as your code. A brute force approach isn't going to work very well,
especially in this case. An integer with 7^20 trailing zeros isn't even
going to fit in your RAM.
An observation: every trailing zero implies a
Just a tidbit:
A neat function my friend came up with last year to figure out the
length of a whole number (now converted to python for your viewing
pleasure):
from math import log10 as log
from math import floor
def findNumberLength(number):
number = float(number)
x = log(number)
x
On Friday 06 June 2008 18:19:23 you wrote:
On Thu, June 5, 2008 9:39 am, Andreas Kostyrka wrote:
On Thursday 05 June 2008 00:18:55 Marilyn Davis wrote:
You listed __init__ and I'm not sure I know what you mean.
Well, __init__ can assign attributes to the instance that are callable.
Oh,
On Fri, June 6, 2008 3:37 pm, Andreas Kostyrka wrote:
On Friday 06 June 2008 18:19:23 you wrote:
On Thu, June 5, 2008 9:39 am, Andreas Kostyrka wrote:
On Thursday 05 June 2008 00:18:55 Marilyn Davis wrote:
You listed __init__ and I'm not sure I know what you mean.
Well, __init__ can
On Thursday 05 June 2008 00:18:55 Marilyn Davis wrote:
You listed __init__ and I'm not sure I know what you mean.
Well, __init__ can assign attributes to the instance that are callable.
Andreas
signature.asc
Description: This is a digitally signed message part.
On Fri, May 23, 2008 at 2:25 PM, Moishy Gluck [EMAIL PROTECTED] wrote:
I came in python around 2.5. So I've been using Boolean and 1 or 2.
For Python 2.5 you should use the new syntax
1 if Boolean or 2
It doesn't have the problems of the unofficial syntax you quote.
Kent
I don't know if this is the best solution, but what I usually do is
create a list that matches the key:
mydict = {}
mylist = []
for x in range(1, 10):
key = raw_input(Enter the key: )
mydict[key] = value
mylist.append(key)
You just have to change it to read from a file/hard code all
line.strip()
for line in file: = line will contain '\n' at the end of the string.
Andreas
Am Montag, den 14.04.2008, 00:08 -0700 schrieb Que Prime:
This is what I came up with after writing it out and reading the
corresponding functions. I feel I'm close but something is still
awry.
Marc Tompkins wrote:
Myself, I have a horrible time writing pseudocode without slipping into
real-code syntax
Me too - often Python is more concise, precise and expressive than
English for expressing an algorithm.
while len(possibleQuestions) 0:
could be simply
while
Would you consider a python-Tutor team member who:
1. Is new to Python?
2. Never worked with a programming team before?
3. Doesn't have much gaming experience?
4. Doesn't have a recent version of MS-Windows (has Mac OS X or GNU/Linux)?
5. May not be running the latest and greatest version of
Greetings,
I ran the code sample you sent and found a couple of errors
that wouldn't let the code run.
The first error has to do with variable assignment.
When you assign a variable, it is usually on the left and
what you want to assign to it is on the right. See Lines 25,29.
The second error
print 'testvar: %.2f' % testvar
Output:
testvar: 10.0123
Should be:
print 'testvar: %.4f' % testvar
Output:
testvar: 10.0123
--
bhaaluu at gmail dot com
On 9/24/07, bhaaluu [EMAIL PROTECTED] wrote:
Greetings,
I ran the code sample you sent and found a couple of errors
that wouldn't let
It's not a homework problem it is a practice problem to figure out how to
code, to be able to do the assignments...
Chris wrote:
If I sent you the problem can you build it so I know what it is suppose to
look like? I've spend too much time it, and made it worse...all I know is
that it does
Terry [EMAIL PROTECTED] wrote
I was using the t1 == int(t1) type compare, that I
learned in BASIC about 25 years ago, to discover
a remainder or no.
What a pity. Even the most elementary BASIC has
always had the MOD operator for finding remainders.
and a \ operator for integer division.
Sorry about all that trouble for you Alan, after I posted that, I
reformatted my code a bit and updated it to do the defining and then
the calling, like you said. The only problem I had, and I was
probably doing something wrong, was that I would do:
choice()
if choice in[1,circle]:
circle()
Adam Urbas wrote:
Sorry about all that trouble for you Alan, after I posted that, I
reformatted my code a bit and updated it to do the defining and then
the calling, like you said. The only problem I had, and I was
probably doing something wrong, was that I would do:
choice()
if choice
2007/5/30, Brian van den Broek [EMAIL PROTECTED]:
Another fwd, folks.
Brian vdB
Original Message
Subject: Re: [Tutor] trouble with if
Date: Tue, 29 May 2007 23:28:46 -0500
From: Adam Urbas [EMAIL PROTECTED]
To: Brian van den Broek [EMAIL PROTECTED]
References: [EMAIL
I can't exactly show you the error message anymore, because the program is
now screwed up in so many ways that I can't even get it to do the things it
used to.
It says things like ERROR: Inconsistent indentation detected!
1) Your indentation is outright incorrect (easy to fix), OR
2) Your
Ahahahahaha... I have figured these out beyond comprehension and power.
Wahhaha. It feels good to get something to work correctly. Thanks much
Andre. I don't quite understand the putting of things inside the
parentheses, but I've discovered that I don't really need to, because def
text():
Adam Urbas said unto the world upon 05/30/2007 11:01 AM:
I can't exactly show you the error message anymore, because the program is
now screwed up in so many ways that I can't even get it to do the things it
used to.
It says things like ERROR: Inconsistent indentation detected!
1) Your
I can't seem to get the type with the parameters to work. I can get
def answer(): to work, but not def
answer(my_first_parameter,my_second_parameter):. I'm not too
concerned, as I haven't yet needed to use that. But, when I use the
parameter type, it runs without error messages, but doesn't
I think I may have figured it out. I just switched some things around.
On 5/30/07, Adam Urbas [EMAIL PROTECTED] wrote:
I can't seem to get the type with the parameters to work. I can get
def answer(): to work, but not def
answer(my_first_parameter,my_second_parameter):. I'm not too
Ok I forgot to put some things on the previous one. I discovered a
flaw in my loop. It is not infinite. If you select circle, radius,
enter the radius, circle, radius, enter the radius, then the program
stops. I want it to be able to keep going as many times as needed,
infinitely. So that
Once again this is my latest version. I know of several problems,
such as the previously posted infinite looping problem. Also, if
sends you to the wrong place sometimes. Ex: a second ago, I pressed
4 to exit (which does not work either) and it took me to triangle.
I'm not sure how to end the
Hi Adam
flaw in my loop. It is not infinite.
In fact you don't have a loop, your program
is really just a simple sequence.
#Welcome screen:
def welcome():
print Welcome to the Area Calculation Program.
print
welcome()
AG:Since you only call this once there is no point in putting
AG:
Anil,
I'm also confused about what you are trying to do. Are you writing a
client application that talks to a web application? A web application
that talks to a different web application? A new part of an existing web
application? What are you using web.py for? What does facebook have to
do
* Stefan Heyne [EMAIL PROTECTED] [061218 09:51]:
OK, thanksno I get the data into a file output..but I still am stuck
with the formatting...
1) there are brackets around the data that are due to the necessary (??)
conversion to a string
2) I cannot figure out how to insert a newline
doug shawhan wrote:
[lots of stuff!]
You seem to have a penchant for choosing entertaining, albeit confusing,
words to explain what you're thinking.
I have a similar inclination; however, I'll attempt to avoid this so
that my explanation will make more sense :)
Now we begin.
First, an
From: Asrarahmed Kadri [EMAIL PROTECTED]
Date: Oct 12, 2006 9:17 AM
Subject: Re: [Tutor] Help with basic user-data file
To: Rob Andrews [EMAIL PROTECTED]
Thanks.
Can you please also tell me how to check the existence of a file using
python builtin functions.
If path is a string
On Thu, 2006-10-05 at 09:17 -0500, Luke Paireepinart wrote:
(actually from Frank)
I have a parameterized string template, I publish it using
print mytemplate % locals()
Original post asked to create variable in local namespace from string.
so I want to assign a value to a variable whos
Python wrote:
On Thu, 2006-10-05 at 09:17 -0500, Luke Paireepinart wrote:
(actually from Frank)
I have a parameterized string template, I publish it using
print mytemplate % locals()
Original post asked to create variable in local namespace from string.
so I want to assign a value to a
2006/10/4, Kent Johnson [EMAIL PROTECTED]:
hey i added another guessing feature that shuld guess the number in the
most
effective way
but i keep getting into endless loops thought you might want it
any help with the loops would be great
What's the value of number? Where is it defined? If
On Tue, Oct 03, 2006 at 05:05:59PM +1300, Liam Clarke wrote:
Original Message
Subject: Re: [Tutor] database web app, what tool?
Date: Mon, 02 Oct 2006 09:33:28 +0100
From: [EMAIL PROTECTED]
To: Liam Clarke [EMAIL PROTECTED]
References: [EMAIL
To: Liam Clarke [EMAIL PROTECTED]
References: [EMAIL PROTECTED]
[EMAIL PROTECTED] [EMAIL PROTECTED]
Thank you Liam,
Our web server is IIS, but it would be no problem to use
another one for this
particular purpose.
I'v been looking for information on how to design tables
Alan Gauld wrote:
Why does the python shell says this:
print exec.__doc__
File stdin, line 1
print exec.__doc__
^
SyntaxError: invalid syntax
exec, like print, is a statement, or command, not a function.
You get the same response if you try
print print.__doc__
Why does the python shell says this:
print exec.__doc__
File stdin, line 1
print exec.__doc__
^
SyntaxError: invalid syntax
While it works with eval.
Anyway, I'm quite impressed with the resposiveness of this list. Thanks
a lot.
Zsiros Levente wrote:
Sorry, the
Why does the python shell says this:
print exec.__doc__
File stdin, line 1
print exec.__doc__
^
SyntaxError: invalid syntax
exec, like print, is a statement, or command, not a function.
You get the same response if you try
print print.__doc__
or
help(print)
While
I forgot the most important thing: the attachment.
OK, Here is my annotated version. not sure if it
will solve your problem though...
#
#!/usr/bin/python
# In this program I wanted to write the event B1-Motion
on my own, combining Button-1, Motion and
Zsiros Levente wrote:
Sorry, the source was for my tkinter question. I'm a bit disorganized
today.
The problematic part is the 11. line, where I have to convert the item
selected from the list to an object, or something like that. At the
moment it only applies to a string object, but I
Bill Carson wrote:
Do you know how to create instances of dictionaries, lists, integers,
longs, etc without having to specify it in code...
Instead of specifying:
a={bla:1}
or ...
a=[1,2,3]
Is there another way??
I'm not really sure what you are looking for here.
shivayogi kumbar wrote:
I downloaded python plugin for eclipse by directly downloading zip file
and extracting under eclipse folder; because it could not update via
PROXY. It was suggested to update plugins from eclipse IDE only. I am
unable to use that plugin(Python) in eclipse. Is it
Sorry guys, total brain fart there :-)
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On 15/03/06, Sam B [EMAIL PROTECTED] wrote:
I'm keen!
what shoe type do you reccomend?
Non-marking cross trainers will do.
If you want to spend more money, go into shoe clinic and tell them you
want shoes for playing indoor ultimate. I ended up with a pair of
Adidas handball shoes. Expect
Here's one way we can avoid the problem:
while True:
word = f.readline()
defn = f.readline()
if not word or not defn:
break
...
Does this make sense?
It does mostly...I don't see why you need the:
if not word or not defn:
Hi Ben,Yes, that's the point: Python doesn't know when to stop.*grin*
The way we've rewritten the loop:while True:...is an infinite loop that doesn't stop unless something in the loop'sbody does something extraordinary, like breaking out of the loop.
Python is much dumber than we might expect.In
Hi Ismael,
I'm glad you found the answer. It is very enlightening as I thought I
had to do with locale and did some tests without getting the problem (I
do not have BS installed now)
As I speak Spanish this had got me worried. :/
Hugo
Ismael Garrido wrote:
Found the problem myself.
(look
Liam Clarke wrote:
And, a question for the group, I've always found that line[:1] is a
complicated way of writing line[0]... is there any time when line[:1]
!= line[0]?
Actually I would say that the general case is for them to be different and in
the special case where line is a string they
Ed Singleton wrote:
A quick tip for the Windows command line.
Ctrl-C, Ctrl-A etc don't work, neither does right-clicking
(menu-click). However, right-clicking does work on the blue title
bar.
Right-click on the blue title bar and then go down to Edit and then
you can Select All. Then
On 10/21/05, Kent Johnson [EMAIL PROTECTED] wrote:
Ed Singleton wrote:
A quick tip for the Windows command line.
Ctrl-C, Ctrl-A etc don't work, neither does right-clicking
(menu-click). However, right-clicking does work on the blue title
bar.
If you turn on Quick Edit (from
I am a noob to converting pointers in C++ to arrays in
python, although the first time I see it done, I will
have no problem. Can you help converting the below
(what I think is the 'decoder' section) to python?
It won't be working code but I think this is whats happening...
UINT
Alan Gauld wrote:
return (UINT)(dst - dstStart);
}
This looks odd, I don't think I understand what it does.
It seems to return an address thats potentially (probably?!)
before the start of the original dst...
It's returning the length of dst.
Kent
This is exactly what i was looking for
For those following, the \x00 added at the end of the
packet is just imaginary and represents
in the meantime, I made the following that just
'decobs' a series of packets (only 8-10 bytes) that
are coming in over the com port. (my incoming packets
also
def UnStuffData(src,dst,len):
for code in src:
for i in range(1,code):
dst.append(i)
if code 0xff
dst.append('\0')
the above is the below code uncommented...
it(and the original code) just seem to find the end
and puts a zero there...
I do not see the
Michael Cotherman wrote:
def UnStuffData(src,dst,len):
for code in src:
for i in range(1,code):
dst.append(i)
if code 0xff
dst.append('\0')
the above is the below code uncommented...
it(and the original code) just seem to find the end
and puts a
. Hartley [EMAIL PROTECTED]
Reply-To: D. Hartley [EMAIL PROTECTED]
To: Alberto Troiano [EMAIL PROTECTED]
Subject: Re: [Tutor] Fwd: Fwd: Python riddles
Date: Sat, 7 May 2005 17:45:32 -0700
Alberto, banner is not a method or a function or anything, it's a
unix trick. also look at run-length encoding
Alberto Troiano wrote:
Now I'm stucked in the riddle 6
As I understand I have to find a secret file (which I have but inside there
is like 900 files)
and do something with it
One of the files has a name that is unlike all the other ones; take a
look at that one.
Is it like number
On May 5, 2005, at 19:39, D. Hartley wrote:
Ok, now, I'm sure this sounds like a very dumb question. But I
clicked on riddle 1, and I don't know how this thing works - about
didnt give a lot of extra info. Am I trying to duplicate something on
my screen that looks like the picture on the
OK, No fancy math here, so thee might be a cleaner way, but here
is how I'd do it.
(Note the patient only has 5mg tabs, which they can split to make
dose
adjust my 2.5)
OK so we are dealing with a unit size of 2.5mg. Convert the total
dosage into 2.5mg units. 35mg = 35/2.5 = 14 units
Divide
On Tue, 22 Mar 2005 22:59:00 -, Alan Gauld [EMAIL PROTECTED] wrote:
OK, No fancy math here, so thee might be a cleaner way, but here
is how I'd do it.
Yikes.
Thanks for insight and solving it,
Btw, I bought your book a while ago and it was the first that
explained classes to me in a a a
I got one or two, same recipient...
Jacob
Anyone else getting these?
-- Forwarded message --
From: [EMAIL PROTECTED]
[EMAIL PROTECTED]
Date: Sun, 13 Feb 2005 17:59:35 -0800
Subject: Delivery Status Notification (Failure)
To: [EMAIL PROTECTED]
This is an automatically generated
perhaps it's the same Bob Gailer in this thread here? -
http://mail.python.org/pipermail/tutor/2005-February/035774.html, in
which case you should probably not see any such messages anymore.
-jf
On Mon, 14 Feb 2005 22:06:51 -0500, Jacob S. [EMAIL PROTECTED] wrote:
I got one or two, same
I've emailed him about it, I think it's an autodirect somewhere on his end.
On Tue, 15 Feb 2005 12:39:15 +0800, Jeffrey Lim [EMAIL PROTECTED] wrote:
perhaps it's the same Bob Gailer in this thread here? -
http://mail.python.org/pipermail/tutor/2005-February/035774.html, in
which case you
301 - 389 of 389 matches
Mail list logo