On Wed, Feb 10, 2010 at 10:27 PM, invincible patriot
wrote:
> hi
> i want to compare a string with a dictionary
> or u can say that i want to take user input A STRING, and want to compare
> each character of that string with the KEYS in the dictionary, and then i
> wana print the values for the c
On Thu, Feb 11, 2010 at 12:12 AM, invincible patriot
wrote:
> thanks
> let me clear you that what i am trying to do
> suppose we hav a input string and a dict
> our_dict={'a':'u', 't':'a', 'c':'g', 'g':'c'}
> input_string='atcg'
>
>
> now what i wana do is that where ever we are having 'a' i wana
On Sat, Feb 20, 2010 at 8:07 AM, Shurui Liu (Aaron Liu)
wrote:
> How to describe a math formula: sphere=(4/3)*PI*R**3?
A function seems like the logical thing to do:
import math
def spherical_volume(radius):
return (4.0/3)*math.pi*radius**3
--
André Engels, andreeng...@gmail.com
_
On Mon, Mar 8, 2010 at 5:05 PM, Karjer Jdfjdf wrote:
> I want to compare words in a text to a dictionary with values attached to
> the words.
>
> The dictionary looks like:
> { word1: [1,2,3] word2: [2,3,4,a,b ] ... }
>
Please give the actual dictionary, not something that it 'looks like' - an
On Thu, Mar 11, 2010 at 4:32 PM, Ken G. wrote:
> If the following program change list[2] to 2010, replacing 1997 (and it
> does), why doesn't the second program work in changing line[ 9:11] to 20
> from 08?
> FIRST PROGRAM:
>
> list = ['physics', 'chemistry', 1997, 2000]
> print list[2]
> li
On 3/12/10, yd wrote:
> Hi,
> I am new to programming, altough i have read a few books about OOP and
> O'Reily's Learning Python.
> I would like some critique on my first program, is it normal for it to be
> this long to do something simple?
Well, many of your lines are user interface. Writing tw
On Sat, Mar 13, 2010 at 3:11 AM, Ray Parrish wrote:
> Andre Engels wrote:
>>
>> On 3/12/10, yd wrote:
>>> else:
>>> raise Exception('{0}, is not a valid choice'.format(choice))
>>>
>>
>> This will cause the program to stop-w
On Sat, Mar 13, 2010 at 7:56 PM, Marco Rompré wrote:
> Hello I have a little problem, I am trying to define a function ligneCar(n,
> ca) that would print n times the caracters ca.
> For now I have the user entering a short sentence corresponding to ca.
> Here is my code:
> def ligneCar(n,ca):
>
2010/3/25 spir ☣ :
> Hello,
>
>
> I'm writing a kind of language simulation. Here, an expression like "a#3.b"
> maps to a NamedData node, with an attribute
> terms=[('.','a'),('#',3),('.'''b')].
> (The lang uses '#' instead of "[...]" for item indexing.)
> When this node is "run", the source code
On Mon, May 3, 2010 at 7:16 AM, Thomas C. Hicks wrote:
> I am using Python 2.6.4 in Ubuntu. Since I use Ubuntu (with its every
> 6 months updates) and want to learn Python I have been working on a
> post-install script that would get my Ubuntu system up and running with
> my favorite packages qui
On Mon, May 3, 2010 at 10:19 AM, Luke Paireepinart
wrote:
> Hmm, why not
> lines = [line for line in lines if not line.strip().startswith('%')]
I knew I missed something
--
André Engels, andreeng...@gmail.com
___
Tutor maillist - Tutor@python.
On Tue, May 18, 2010 at 5:14 AM, Luke Paireepinart
wrote:
> Forwarding. Peter use reply-all don't reply offlist please.
>
> -- Forwarded message --
> From: Peter
> Date: Mon, 17 May 2010 10:08:47 -0400
> Subject: Re: [Tutor] Learning python using Michael Dawson's book
> To: Luke P
On Tue, Jul 13, 2010 at 11:50 AM, Dipo Elegbede wrote:
> I was trying to write a code that prints prime numbers between 1 and 20.
>
> I have by myself seen that something is wrong with my code and also my
> brain.
>
> Could anyone be kind enough to tell me what to do
>
> Where I am confused is
On Wed, Jul 14, 2010 at 6:31 AM, Monte Milanuk wrote:
> Hello all,
>
> I'm struggling a bit trying to find the right way to deal with null values
> in my sqlite database when querying it and processing the results in python.
>
> If my cursor.fetchall() results return the following:
>
> (104, None,
On Tue, Jul 13, 2010 at 12:34 PM, Nitin Pawar wrote:
> Adding to what Andre said,
> another way of optimizing the problem would be
> storing the prime number in the range you want to check an array and see if
> the given number is divisible by any of those prime number
As I wrote, my code was not
On Wed, Aug 11, 2010 at 3:11 AM, rara avis wrote:
> Hi: I am trying to teach myself Python, and am stuck at the indentation with
> the elif statement.
> This is what I am trying to type:
>
> x=3
> if x==0:
What are you trying to accomplish? What result did you expect to get?
What result did you a
On Sun, Sep 5, 2010 at 4:17 PM, Roelof Wobben wrote:
> I understand the error message.
> I follow this example in the book :
> http://openbookproject.net/thinkcs/python/english2e/ch11.html
> And there element is not defined.
It is:
for element in nested_num_list:
--
André Engels, andreeng..
On Sun, Sep 5, 2010 at 8:51 PM, Micheal Beatty wrote:
> On 09/05/2010 01:26 PM, Evert Rol wrote:
>>>
>>> Hello all,
>>>
>>> I'm having a little problem figuring out how to accomplish this simple
>>> task. I'd like to take a list of 6 numbers and add every permutation of
>>> those numbers in group
On Mon, Sep 6, 2010 at 8:34 AM, Roelof Wobben wrote:
> Hello,
>
> I have this programm:
>
> def encapsulate(val, seq):
> if type(seq) == type(""):
> return str(val)
> if type(seq) == type([]):
> return [val]
> return (val,)
>
> def insert_in_middle(val, seq):
> midd
On Mon, Sep 6, 2010 at 9:41 AM, Roelof Wobben wrote:
>
>
>> To: tutor@python.org
>> From: alan.ga...@btinternet.com
>> Date: Mon, 6 Sep 2010 08:27:31 +0100
>> Subject: Re: [Tutor] why do i get None as output
>>
>>
>> "Roelof Wobben" wrote
>>
>> def make_empty(seq):
>> word2=""
>> teller=0
>> if t
On Tue, Sep 7, 2010 at 12:44 AM, lists wrote:
>>> Assuming that mytext is "test", I've found that mytext[-1:-4:-1]
>>> doesn't work (as I expected it to) but that mytext[::-1] does.
>>>
>>> While that's fine, I just wondered why mytext[-1:-4:-1] doesn't work?
>>
>> How does it not "work"? What did
On Sun, Sep 19, 2010 at 7:02 PM, Roelof Wobben wrote:
>
>
>
>
>> From: rwob...@hotmail.com
>> To: __pete...@web.de
>> Subject: RE: [Tutor] Can this be done easly
>> Date: Sun, 19 Sep 2010 17:01:22 +
>>
>>
>>
>>
>> ---
On Sun, Sep 19, 2010 at 8:33 PM, Roelof Wobben wrote:
> Hello,
>
> I changed the programm to this :
>
> import unittest
> class Point:
> def __init__(self, x=0, y=0):
> self.x = x
> self.y = y
>
> class Rectangle(object):
> def __init__(self, base_point, width=0, length=0):
>
On Tue, Nov 23, 2010 at 2:16 PM, Jose Amoreira wrote:
> Is there a more straightforward way of solving my specific problem or, better
> yet, a general solution to the need of a variable number of for loops?
If you need a variable number of loops, put the loops themselves in a
loop, which you go
On Sun, Feb 15, 2009 at 1:37 PM, Emad Nawfal (عماد نوفل)
wrote:
> I'm not sure this is the best strategy, but it seems to work:
>
url ="http://this/is/my/url/to/parse";
m = url.replace("//", '/').split("/")
n = m[0]+"//"+"/".join(new[1:])
n
> 'http://this/is/my/url/to'
What i
On Mon, Feb 16, 2009 at 10:01 PM, Wayne Watson
wrote:
> My limited repertoire. Actually, there wasn't much of a traceback. It came
> up in a small OK dialog. I copied what I could. I see my image I used above
> did make it to the list, so here's the skinny.
>
>
> I see Marc covered it with setatt
On Tue, Feb 24, 2009 at 8:03 PM, nathan virgil wrote:
> I'm experimenting with OOP using the Critter Caretaker script from Python
> Programming for the Absolute Beginner as my basis. I've noticed that a
> dictionary/function combo is a great way to handle menus, and so I've
> adapted the menu to r
On Wed, Feb 25, 2009 at 12:47 AM, Andre Engels wrote:
> - Show quoted text -
> On Tue, Feb 24, 2009 at 8:03 PM, nathan virgil wrote:
>> I'm experimenting with OOP using the Critter Caretaker script from Python
>> Programming for the Absolute Beginner as my bas
On Wed, Feb 25, 2009 at 2:32 AM, nathan virgil wrote:
> Erm, it's still not working...
>
> Whenever I try to use the talk method (which reports the mood, and doesn't
> take parameters), it says I gave it too many parameters. Maybe it might help
> if I posted the code in it's entirety
>
>
> # C
On Fri, Feb 27, 2009 at 6:06 AM, David wrote:
> Hi Everyone,
> I go through the archived [Tutor] mail list to find programs others have
> tried to do. I found one that would keep track of a petty cash fund. please
> point out my misunderstanding.
> Here is what I started with;
>
> #!/usr/bin/pyth
On Tue, Mar 3, 2009 at 4:54 AM, Wayne Watson
wrote:
> What is this: d = [ int(x) for x in s.split(":") ]
> I see in the program I'm looking at, the [] construction can be much more
> complicated, as in:
> self.recent_events = [ event for event in self.recent_events
>
Please next time, if possible, add the complete error message you get.
In this case, it tells us that the error is in this line:
if sig == wordList[i]
You forgot the : at the end of this line (also, the next lines are not
indented extra, as they should).
On Mon, Mar 9, 2009 at 9:28
2009/3/11 Emad Nawfal (عماد نوفل) :
> Now I know that I did not ask the right question. What I meant was: how to
> extract a sublist from a list whose length is unknown. Let's say I have a
> hundred of these lists and each of these has an NP somewhere, it could be
> nested in nested list, which is
On Mon, Mar 16, 2009 at 3:47 AM, Patrick wrote:
> Hi Everyone
>
> I am trying to write a program that creates a bunch of svg files and
> then edits their values. I am then encoding them into a video. It's not
> encoding right because my filenames are wrong. They have to have a
> sequence. Right no
I have an open source project I have done some work on, which is
programmed in Python 2.3-2.6. I would like to change it so that it can
be run under both Python 3 and Python 2.x. Two questions for that:
* is there a place where I can find an overview of what to do to make
such a change?
* is there
2009/4/28 Marek spociń...@go2.pl,Poland :
>> Hello,
>>
>> The following code returns 'abc123abc45abc789jk'. How do I revise the
>> pattern so
>> that the return value will be 'abc789jk'? In other words, I want to find the
>> pattern 'abc' that is closest to 'jk'. Here the string '123', '45' and '7
On Fri, May 15, 2009 at 6:46 AM, R K wrote:
> Gurus,
>
> I'm trying to write a fairly simple script that finds the number of hours /
> minutes / seconds between now and the next Friday at 1:30AM.
>
> I have a few little chunks of code but I can't seem to get everything to
> piece together nicely.
On Mon, Jun 8, 2009 at 11:57 AM, Mike Hoy wrote:
> I have the following code:
>
> import gzip
> import datetime
> date = datetime.date.today()
> name = date.strftime('%m-%d-%Y')+'.gz'
> date.strftime('%m-%d-%Y')+'.gz'
> print "The name of the file will be", name
>
> the output is:
> The name of the
On Fri, Jun 12, 2009 at 3:00 AM, Randy Trahan wrote:
> Attached is an error I cannot get to work, I was doing a print concatenation
> but it won't let me get past "+ "ibly impressive. " \
> (then to next line)
It's wrong at a few places, but the first is at the very beginning.
You need a quote mar
On Sat, Jun 20, 2009 at 9:49 AM, Michael Morrissey wrote:
> I need to generate all possible deck combinations given two different lists
> as input.
> The Input:
> List 1 has Card names listed inside it.
> List 2 has Maximum Quantities for each Card name.
>
> For example:
>
> List1[0] would be: "Aet
On Sun, Jun 28, 2009 at 5:00 PM, Amit Sethi wrote:
> Hi , I don't suppose python has a concept of interfaces. But can somebody
> tell me if their is a way i can implement something like a java interface
> in python.
Sure. Interfaces are just Java's compensation for not having multiple
inheritance
On Thu, Jul 16, 2009 at 11:22 AM, Gregor Lingl wrote:
> That's simply not true in Python. Try it out!
>
word = "cat"
word[1] = "_"
> Traceback (most recent call last):
> File "", line 1, in
> word[1] = "_"
> TypeError: 'str' object does not support item assignment
And the reason for
On Fri, Sep 4, 2009 at 2:20 PM, zhang allen wrote:
> Hi All,
>
> Say i have unicode string Büro.
> i want to iterate this string .
>
> i write this python code which doesn't work.
>
> s ='Büro'
> for ch in s:
> print ch
>
> it seems Büro has 5 chars. ü consists of 2 bytes.
>
> so does someone
On Sat, Sep 12, 2009 at 10:35 AM, ranjan das wrote:
> Hi,
>
> I am new to python and i wrote this piece of code which is ofcourse not
> serving my purpose:
>
> Aim of the code:
>
> To read a file and look for lines which contain the string 'CL'. When found,
> print the entry of the next line (posi
On Tue, Oct 6, 2009 at 5:08 PM, Wayne wrote:
> On Tue, Oct 6, 2009 at 9:58 AM, Dave Angel wrote:
>>
>>
>>
>> No, because you're not assured that all integers that are equal are the
>> same object. Python optimizes that for small integers, but there's no
>> documented range that you can count on
On Thu, Oct 15, 2009 at 11:28 AM, Mr Timothy Hall
wrote:
> hi,
> i am writing a program for a runge-cutter method of solving ODE's and im
> having a problem with one part.
>
> whenever i run this part of the program, no matter what values i put in for
> vto, k1t etc... it always equals zero.
> im
On Thu, Oct 15, 2009 at 5:14 PM, David Perlman wrote:
> I'm trying to figure out how to define a class so that its instances have a
> method that return a different object of the same class.
>
> In particular, I'm trying to run a simple prisoner's dilemma game, and I
> want to make a "game" object
On Mon, Oct 19, 2009 at 3:29 AM, Wayne wrote:
> Hi, I think I recall seeing this here, but I wanted to make sure I'm
> correct.
> Is the best way to test for an empty list just test for the truth value?
> I.e.
> mylist = [1,2,3]
> while mylist:
> print mylist.pop()
Whether it is the 'best' way
On Tue, Nov 3, 2009 at 4:20 PM, Robert Berman wrote:
>
> In [69]: l1=[(0,0)] * 4
>
> In [70]: l1
> Out[70]: [(0, 0), (0, 0), (0, 0), (0, 0)]
>
> In [71]: l1[2][0]
> Out[71]: 0
>
> In [72]: l1[2][0] = 3
> ---
> TypeError
On Fri, Jan 1, 2010 at 11:17 AM, Eldon L Mello Jr wrote:
> Hi there,
>
> I must say I'm quite embarrassed about my issue. Ok, I'm a 101% newbie in
> programming and all but I honestly didn't expect I would have problems in my
> very first step which was just to print 'hello world'.
>
> Despite som
On Tue, Jan 5, 2010 at 1:46 PM, 朱淳 wrote:
> I've token a dictionary to save filenames, and write it into "constant.py".
> And I think it's a good method to create a class as Andre wrote. Thank you
> all!
> By the way, if I close a open file object, will the closed file object still
> occupy the m
Is it possible to call a web browser from Python, opening a certain
page? Preferably the user's standard web browser.
Andre Engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
wrong. That is, say "if I run this program (with this-and-that
input if that's important), I would expect to get such-and-such, but I
get so-and-so instead."
Andre Engels
On 7/5/05, Nathan Pinno <[EMAIL PROTECTED]> wrote:
>
>
> What's wrong with this code? I'm usi
is case it
said "len() of an unsized object". There is only one len() in the line
given, so that must be it, and thus in_file must be that 'unsized
object'.
Andre Engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
inLine == '':
inFileLeft = 0
else:
print inLine
file.close()
printTextFile('c:/Python24/outputs_1ubq_alignments/output_1ubq_alignments_10%.txt')
printTextFile('c:/Python24/outputs_1ubq_alignments/output_1ubq_alignments_20%.txt')
# end of code
There are other things that could be improved, but this is the main one by far.
Andre Engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
d with no
output? Did it NOT end with no output? Did you get an error message?
Andre Engels
On 7/20/05, Jimmy <[EMAIL PROTECTED]> wrote:
>
>
>
> My assignment is this:
>
> 4. Read chapter 3 from "How to Think Like a Computer Scientist" (see the
> background materials
o_1()
>>> x.data = "boring"
>>> print type(x), type(x).mro()
[, ]
>>> get_class_resolution(x)
[, ]
'instance'
To get your desired behaviour, you need something like:
>>> class foo_1(object):
data = ""
>>> x = foo_1(
-- Forwarded message --
From: Andre Engels <[EMAIL PROTECTED]>
Date: 24 apr. 2007 17:18
Subject: Re: [Tutor] how to stop a function
To: shawn bright <[EMAIL PROTECTED]>
2007/4/24, shawn bright <[EMAIL PROTECTED]>:
> hello all,
>
> i have a gui app tha
then one could print None)
> >>> print z
> None
> ___
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
n of printout to:
def printout(firstword, secondword = None):
if secondword is None:
(firstword,secondword) = firstword
print firstword
print secondword
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
and I am hoping by storing all the data in the database and only
> retrieving it when I need it will help reduce the memory footprint of
> my server
> ___
> Tutor maillist - Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
level than the whole program - check where you get
the ValueError, put that line in a try, and take an appropriate action
in the except.
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Is the same true of Python? Or is ok to use Exception handling like the book
> suggests?
Exceptions are in general much more freely used in Python than in most
other languages, it's called the "EAFP" (It's easier to ask
forgiveness than to get permission) style, instead of the
can
be done with:
counter = 0
while counter < 100:
print "Do something"
counter += 1
but of course the 'for' solution is still shorter than this.
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ype 'circle' instead of '1', you can do:
if shape == "1" or shape == "circle":
or alternatively:
if shape in ["1","circle"]:
Andre Engels
2007/5/23, adam urbas <[EMAIL PROTECTED]>:
>
> Hi all,
>
> I've been w
xt")
There is a much used method to make some of the parameters optional,
but we'll not go into that.
To know what is going wrong with your program, I would have to see the
program (or a simplified version of it that still goes wrong) and
preferably also the exact error message you are g
than incrementing
> a variable (x = x + 1) every loop?
>
> Or maybe can I access the number of times the loop has run? ('x = x +
> 1' is so common there must be some more attractive shortcut).
See my second example above?
Andre Engels
___
Your program has:
q = random.choice(range(15,31)
cq = 1
while cq >= q:
q has a value between 15 and 31, cq equals 1. 1 is not greater than or
equal to any number between 15 and 31, so cq >= q is always false. I
think you meant to write:
w
not valid"
>
> if day <= months[11]:
> d = "valid"
> else:
> d = "not valid"
>
> if day <= months[12]:
> d = "valid"
> else:
> d = "not valid"
>
> print "The date you entered", date1, "is", d +"."
>
> main()
Correct and shortened code:
Instead of the whole line "if day <= months[1]"... series of
if-then-else statements, use only one statement, namely:
if day <= months[month]:
d = "valid"
else:
d = "not valid"
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
before releasing it to the
public). Is it possible with httplib to connect to password protected
sites (given that I know the login and password of course), and if so,
how is this done? If not, is there an alternative?
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
PUT'
operations. These are done using httplib rather than urllib, and I
cannot see at this point how I can mimick those using urllib2.
Andre Engels
2006/3/1, Kent Johnson <[EMAIL PROTECTED]>:
> Andre Engels wrote:
> > I am active in pywikipediabot, which is programmed in P
2006/3/2, Kent Johnson <[EMAIL PROTECTED]>:
> Andre Engels wrote:
> > Thanks for your help; it brought me quite a bit farther, but not as
> > far as I wanted to come. The authentication is basic authentication,
> > and I have been able to adapt the programs so that I now
combine the two
handlers (the one for authentication and the one for cookies). Apart
from that I hoped that because the program already has cookie handling
programmed in, reusing that code might be less trouble than splitting
the authenticated and the non-authenticated case everywhere.
--
Andre
Thanks for your answers! It is working now!
2006/3/3, Kent Johnson <[EMAIL PROTECTED]>:
> Andre Engels wrote:
> > 2006/3/3, Kent Johnson <[EMAIL PROTECTED]>:
> >
> >
> >>Have you tried using a CookieManager as shown in the first example here:
> >>
in expatreader.py. There
is a line there:
self._parser.Parse(data, isFinal)
self._parser, as I have found, is an object of the class
pyexpat.xmlparser, but I have no idea about where to fine pyexpat. Can
anyone help me further?
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
2006/4/18, Kent Johnson <[EMAIL PROTECTED]>:
> Andre Engels wrote:
> > I am working for the Python Wikipediabot Framework
> > (http://www.sourceforge.net/pywikipedia). A user noted me to an
> > apparent deadlock in the XML parsing. I tried to get to the actual
>
t the text (and another text that did not cause problems) to
Danny; sending it to this list was disallowed because of length (about
1.5M for the 'slow' case and about half of that for the 'fast' one).
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
__
._a = a
self._seen = 0
def touch(self):
self._seen += 1
def count(self):
return self._seen
def obj(a):
try:
return objects[a]
except KeyError:
objects[a] = myObj(a)
return objects[a]
objects = {}
x = obj("a")
y = obj("
al (not exponentional form), and the .1 means that there
should be 1 digit after the decimal dot.
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
> You can use string formatting here:
> "Je Body Mass Index is %.1f"%gewicht/lengte**2
Actually, I'm not sure this word work correctly. Better:
"Je Body Mass Index is %.1f"%(gewicht/lengte**2)
that should definitely owrk
--
Andre Engels, [EMAIL PROTECTED]
IC
"%(x,y,x+y)
will evaluate to:
"1+2=3"
> join?
Join is a method of a string. Its syntax is:
x.join(y)
where x must be a string and y a sequence of strings. It denotes a
string, consisting of the strings in y, with x between each pair.
Again, a few examples will make it more clear:
lue of number? Where is it defined? If number is not an
integer or number > ran, then you will indeed end up in an infinite
loop.
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
28125, 244140625)
by
lst = [5]
and after b=input()
add:
while lst[-1]*5 < b:
lst.append(lst[-1]*5)
And finally I wonder why on Earth you would worry about the speed of
this program, given that the running time over 1 number is just a
fraction of the time it costs you to type in that
ot;val3"])
elem2\elem1\elem3
but this seems somehow uneligent.
Are there a more efficient/compact ways of doing this kind of
operation or is this it?
Maybe you like:
print "\\".join([config[val] for val in ["val2","val1","val3"]])
--
Andre Enge
lt;= c[1] <= ymax:
templist.append(c)
return templist
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
n my local setting), Python automatically searched
for imports in the current directory (the one where the program was run).
With the new one, this does not seem to be the case, so I am getting
ImportErrors all over the place.
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype
er).serve_forever()
instead of redirecting, it only prints 'Location : /cgi-bin/ecodiv.pyw'
inthe
browser
I haven't tested it, but I think I had a similar error recently, and that
was solved by removing the \n\n at the end of the Conte
eq_var, and if it
is called without un_req_var, within the function body un_req_var is
considered to be None.
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/li
mputer.
All actual float values? Depends too much on the implementation of the
specific machine you're working on to be workable.
Identifying values below 48.35 and above 48.45 is simply done by:
if value < 48.35 or value > 48.45 then...
No need to first create the range of values
-
sending it, sometimes long after sending
it, I realize I sent it to the sender instead of the list, so I send a
second message after it. Who knows how often I have failed to do that?
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
_
sume that would work as I
would expect and send to the list and sender?
If so how do you send to the sender only?
Change the address by hand. That's hard to do, it's true, but the number of
times I want to reply in person to a message on a list is so low that that's
no problem
hese operators, you will have to think of the numbers as
binary numbers. Look at the digits. For two numbers x and y, x^y is the
effect of doing an exclusive or on all digits (that is, 0^1 = 1^0 = 1 and
0^0 = 1^1 = 0), & of doing an and (1&1 = 1, 1&0=0&1=0&0=0) and | is an or o
2007/2/19, Dick Moores <[EMAIL PROTECTED]>:
At 02:17 AM 2/19/2007, Andre Engels wrote:
>To understand these operators, you will have to think of the numbers
>as binary numbers. Look at the digits. For two numbers x and y, x^y
>is the effect of doing an exclusive or on all digit
t;
Which still did not result in the *while loop* breaking after attempt No
5.
I would appreciate being explained what I am doing wrong.
It would have helped if you had given the code *with* the extra lines in it.
My first guess is that you did a wrong indentation, but without the actual
companies.write(line)
else:
patentdata.write(line)
in_file.close()
companies.close()
patentdata.close()
Thanks
jay
_______
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
2007/3/23, Jay Mutter III <[EMAIL PROTECTED]>:
On Mar 23, 2007, at 5:30 AM, Andre Engels wrote:
2007/3/22, Jay Mutter III < [EMAIL PROTECTED]>:
>
> I wanted the following to check each line and if it ends in a right
> parentheses then write the entire line to one file an
reads
#!/usr/bin/python
but above any other line, add:
# -*- coding: utf-8 -*-
This tells the parser that this file should be read as unicode.
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@pyth
r yet.
>
> re.compile(r'_{0,3}[A-Z][A-Z0-9\-]*[A-Z0-9]')
I think
_{0,3}[A-Z](\-?[A-Z0-9])+
will do what you are looking for.
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
(the hypehn) is not as the first or last character.
The \-? allows a hyphen, doesn't it?
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
thing".
I don't know about Visual Basic, but in Python these statements are unnecessary.
--
Andre Engels, [EMAIL PROTECTED]
ICQ: 6260644 -- Skype: a_engels
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
1 - 100 of 187 matches
Mail list logo