The problem here is that you have doubled the "for line in f:" line.
Given that you say you know some programming, I'll just cut to the
technical name of the problem you are having: You are changing the
value of a loop variable (by starting an inner loop with the same loop
variable) inside a loop.
On Thu, Nov 17, 2011 at 2:14 PM, Nidian Job-Smith wrote:
> Hi all,
>
> I'm new to programming (thus Python), so after reading the
> basics, I wanted to practise what I've learnt . I've come across a
> beginners exercise which is to programme rot13.
>
> I've written some code but it doesn't seem t
On Wed, Nov 16, 2011 at 9:21 AM, lina wrote:
> it still complaining. I set the gedit, use space not tab,
> Now I even typed space by space, avoid using tab, it still has the same
> problem.
>
> How can I fixed it?
>
The line
if list1[i][j] != list1[i][j+1]:
still contains a tab, th
On Thu, Sep 15, 2011 at 4:01 AM, c smith wrote:
> hi list, i am trying the MIT opencourseware assignments.
> one was to find the 1000th prime.
> since this isn't actually my homework, I modified the solution as I would
> like to collect lists of primes and non-primes up to N, also some log()
> rat
On Thu, Sep 8, 2011 at 4:16 PM, lina wrote:
> On Thu, Sep 8, 2011 at 9:59 PM, Alan Gauld
> wrote:
> > On 08/09/11 14:02, lina wrote:
> >>
> >> Hi,
> >>
> >> I failed to understand the "collpase" meaning in a string.
> >>
> >> can someone give me a simple example?
> >
> > Can you give us some con
On Thu, Aug 25, 2011 at 9:08 PM, Justin Wendl wrote:
> Hi John,
>
> Thanks for the quick response. Unfortunately it is returning the same
> result..
>
>
This is caused by the
else:
break
part of the the code. Break breaks out of the loop, thus you skip all
following elements if you go throu
On Wed, Aug 24, 2011 at 7:40 PM, Ray Parrish wrote:
> Hello,
>
> I haven't been programming for a while and today I am working on something
> and have encountered an error I cannot figure out.
>
> Here is my code:
>
> thisFile = column[6]
> if thisFile == "/Images/My%20Face.JPG"
On Sun, Aug 21, 2011 at 7:25 PM, Emile van Sebille wrote:
> On 8/21/2011 10:08 AM Lisi said...
>
> I have just received the following.* In what way have I transgressed? I
>> apologise to you all - but as I mentioned, I had been stuck for weeks and
>> am
>> running out of time. And I certainly
On Wed, Aug 3, 2011 at 8:07 AM, Richard D. Moores wrote:
> On Tue, Aug 2, 2011 at 21:59, Dave Angel wrote:
>
> > When I paste that from your email into a file and run Python 2.7 on it,
> it
> > behaves fine with no errors. That's in Linux.
>
> I should have said that I'm using Wing IDE Professio
On Mon, Jul 25, 2011 at 4:19 AM, David Merrick wrote:
> def append(self,item):
> '''Adds an item to the end of the List'''
>
> current = self.head
> previous = None
> while current.getNext() != None:
> previous = current
> current
On Wed, Jul 20, 2011 at 4:37 AM, brandon w wrote:
> **
> Hi
> I am running Linux with Python 2.6.6. I have done lists, tuples,
> dictionaries, etc. Now I want to move on to creating a "class". I keep
> getting an error for everything I try. Here is the error: *
>
> NameError: name 'MyClass' is no
On Mon, Jul 18, 2011 at 6:10 PM, surya k wrote:
> Hi,
>
> The problem is to estimate the value of pi using the following series.
> *1 / pi = (( 2 * sqrt(2) )/ 9801 ) * SIGMA of k[ (4k)! (1103 + 26390*k)
> / (k!^ 4 ) * 396^(4k) ]*
> *where k is [0, infinity)*
> * Problem is located at : ThinkP
On Fri, Jul 1, 2011 at 9:29 AM, Vincent Balmori wrote:
>
> Here is the other one that occurs when I lose
>
> Traceback (most recent call last):
> File
>
> "/Users/vincentbalmori/Desktop/Python/py3e_source/chapter09/blackjackbetting.py",
> line 240, in
>main()
> File
>
> "/Users/vincentbalmo
On Fri, Jun 24, 2011 at 8:56 AM, Vincent Balmori
wrote:
>
> <<
> point = int(next_line(the_file))
>
> If x is a string that can be interpreted as an integer number, int(x) is
> that integer number; if the string is not the representation of an integer,
> this will lead to a ValueError.
>
> --
> An
On Tue, Jun 21, 2011 at 10:12 AM, David Merrick wrote:
> I need help using Class methods in another class. I have a class called
> Critter and I want to create two critters in a farm Class Farm and use
> Class Critter's methods
Could you please specify where your current code does not suffice -
On Fri, Jun 17, 2011 at 11:03 PM, Alan Gauld wrote:
>
> "Vincent Balmori" wrote
>
>> Here is my updated code. As simple as this may be, I am a little lost
>> again.
>
> I'm not sure why you are lost because that's pretty much it.
>
>> ... at this point (especially after one week) this is when me
On Tue, Jun 7, 2011 at 11:26 PM, Matthew Brunt wrote:
> i'm very new to python (currently going through a python for beginners
> book at work to pass the time), and i'm having trouble with an if
> statement exercise. basically, i'm creating a very simple password
> program that displays "Access G
On Wed, May 25, 2011 at 6:14 AM, Rachel-Mikel ArceJaeger
wrote:
> I am having trouble with determining when python is passing by reference and
> by value and how to fix it to do what I want:
>
> I am writing a program that will take in a list of book titles and will allow
> many people to rank
On Thu, May 19, 2011 at 8:15 AM, Joe Aquilina wrote:
> I realised after I read your response that I probably hadn't included enough
> information, partly due to my inexperience in Python and partly due to
> haste on my part.
>
> AFter my original post, I had a little play in Python and was able
On Thu, May 19, 2011 at 6:36 AM, Joe Aquilina wrote:
> I am new to this list and very much a beginner to Python. Please excuse me
> if this is a silly question, but in all my searches this morning I have not
> been able to find an answer.
>
> I have a (single table) database file (SQLite3). It ha
I am not able to check your code (I get an error message about the
usage of urllib, but that might be a difference in Python
installations); however, my first guess is that you neglected to take
case into account: The page contains the text "Water", not "water", so
if you input "water", halal_haram
First read file1, and keep the result in a useful data structure (for
this simple case it can be nothing more than a dictionary with the
value in column 1 as key and the value in column 4 as value, but
perhaps it's better to find something else if you want to do more with
the data). Then go through
On Wed, May 11, 2011 at 5:24 PM, Robert . wrote:
> Hi all,
>
> My first post ever! :)
> I'm following the guide "Learn Python the Hard Way" and have reached a point
> where I am struggling to understand the code and unfortunately the authors
> guide hasn't cleared it up for me. (excercise 40 for r
On Thu, May 5, 2011 at 2:19 AM, Kyle Benak wrote:
> I am learning python and I am trying to write a simple "guess the number"
> game. I wrote the program in the IDLE, and I set the variable tries=1 to
> keep up with the number of tries it takes to guess the number, but when I
> try to run the pro
I have not checked the rest of your code, but:
> for line in seqalign:
> for i in len(finalmotif_seqs): # for item in finalmotif_seqs:
> for i in len(finalmotif_annot): # for item in finalmotif_annot:
I see two problems here:
1. You are using the same loop variable in both lo
On Sun, May 1, 2011 at 5:49 AM, Ryan Strunk wrote:
> When I initialize the class which holds these dictionaries, though, I need
> to make sure that all the keys contained in d2 match the keys of d1. Thus I
> tried:
> d1 = {'a': 0, 'b': 0, 'c': 0}
> d2 = d1
> My understanding was that d2 looked at
On Mon, Apr 11, 2011 at 1:01 PM, Sophie DeNofrio wrote:
> Hi Everyone,
>
> I am a super beginner and am little muddled right now. So I apologize for
> the low level question but I am trying to write a function that will return
> a dictionary of a given list of strings containing two coordinates se
On Fri, Apr 8, 2011 at 3:57 AM, Aaron Brown wrote:
> I am in an online python class and am failing badly. I am not sure where
> the problem is here but any insight would be great.
>
> def main():
> while (True):
> allowed = int(input("Please enter minutes allowed between 100 and
> 700
On Wed, Apr 6, 2011 at 4:06 PM, michael scott wrote:
> Is this really a python tutor question? Oh, well, try this:
> http://lmgtfy.com/?q=sqlite+test+if+table+exists
>
> --
> Joel Goldstick
>
>
> My apologies, I was not aware that there were questions I could and could
> not ask. I understand n
On Mon, Apr 4, 2011 at 7:27 AM, Ryan Strunk wrote:
>> I've read your code. Frankly I don't understand your problem. I also don't
> see any occurrence of "health".
> There isn't a reference to health here. My goal is to have this code act as
> a checker for health, fatigue, time_remaining, or any o
On Fri, Apr 1, 2011 at 9:52 AM, ranjan das wrote:
> I have the following information
>
> A={'g2': [4,5,3], 'g1': [1, 3]}
>
> B=[2,3,5]
>
> Now I want to remeove the elements in B if they are present (as values) in
> dictionary A.
>
> My expected solution is
>
> A= {'g2': [4], 'g1': [1] }
>
> I wro
2011/3/24 Rafael Durán Castañeda :
> I can do it with two list comprehensions:
>
list_ = [1, 2, [3, 4], 5, [6, 7, 8], 9]
[x[i] for x in list_ if isinstance(x, list) for i in range(len(x))] + [x
for x in list_ if not isinstance(x, list)]
> [3, 4, 6, 7, 8, 1, 2, 5, 9]
>
> But i lo
On Mon, Mar 21, 2011 at 1:58 AM, sihong lin wrote:
> Hi,
>
> I just write a simplest file test.py with only one line--print "hello",
> when I run it in command line:
> >>> python test.py
>
> the follow message comes out:
>
> File "" , line 1
> python test
>
> SyntaxError: invalid syntax
>
> but
On Thu, Mar 17, 2011 at 8:45 AM, Stefan Behnel wrote:
> Note that a web application involves many things outside of your own code
> that seriously impact the performance and/or resource requirements. Database
> access can be slow, excessively dynamic page generation and template engines
> can bec
On Mon, Mar 14, 2011 at 9:56 AM, Alan Gauld wrote:
> "Yasar Arabaci" wrote
>
>> >>> a=["a"]
>> >>> b=[a]
>> >>> a.append("c")
>> >>> b
>> [['a', 'c']]
>>
>> Apperantly, I can change something (which is mutable) inside a list
>> without even touching the list itself :)
>
> But the point is that y
On Wed, Mar 9, 2011 at 9:21 AM, nookasree ponamala wrote:
> Hi,
>
> I need help in finding the minimum date and maximum date in a file.
> Here is my test file:
> s.no: dt1 amt id1 id2
> 452 2010-02-20 $23.26 059542 06107
> 452 2010-02-05 $20.78 0595
On Tue, Mar 8, 2011 at 5:40 AM, Benjamin Serrato
wrote:
> I wrote a short script to clean up a csv file but had trouble when
> date_time = time.strptime(date_string, "%m/%d/%y")
> would choke on intermittent Null characters in the file. I put it into a
> try-except, but then I found I couldn't d
On Thu, Feb 24, 2011 at 3:03 PM, tee chwee liong wrote:
'0x' + hex(543)[2:].zfill(5)
> '0x0021f'
>
> this is a good way but it's still in string format. but if i convert it to
> long, then the leading 0s will be truncated. i guess can't have it both way.
A long is just a number. You cannot s
On Thu, Feb 24, 2011 at 5:15 AM, Chris Schiro wrote:
> Hi,
>
> I am completely new to programming aside from working with basic many years
> ago. I purchased a Python book for beginners so I could start from scratch
> which has been walking me through just fine until: writing a program to
> intera
On Tue, Feb 1, 2011 at 9:40 PM, John Simon wrote:
> I'm looking for a way to flatten lists inside a list literal, kind of like
> this:
>
start = '('
end = ')'
items = ['abc', '+', 'def']
[start, *items, end]
> ['(', 'abc', '+', 'def', ')']
> Of course, the star doesn't work the
We will not make your homework for you. However, we may well give you hints
and perhaps solve small parts that you are unable to do yourself. For that,
however, we need to know *what* it is that you are having problems with.
Thus: You said that you have tried everything you can. What have you trie
On Mon, Nov 29, 2010 at 6:57 AM, Mary wrote:
> Dear Tutors:
>
> Thank you for your time.I am trying to do first assignment (ps1a+b) onMIT
> open study, finding the 1000th prime in part a and doing something with
> import.math and logs in part b, but I'm not there yet. The little build i
> did to f
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, 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 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 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 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 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 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 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 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 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, 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 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 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 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 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
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 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):
>
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 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 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 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 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 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 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 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
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, 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 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 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 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 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 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 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 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 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 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 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 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, 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.
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
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
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
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
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
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
>
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 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 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 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 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 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 Wed, Feb 4, 2009 at 3:30 PM, David wrote:
> Hello everybody,
>
> I have easily spent some four hours on this problem, and I am now asking for
> rescue.
>
> Here is what I am trying to do: I have a file ("step2", with some 30 or so
> lines. To each line I would like to add " -d" at the end. Fina
On Tue, Feb 3, 2009 at 4:24 PM, Andre Engels wrote:
> On Tue, Feb 3, 2009 at 4:17 PM, H.G. le Roy wrote:
>> Hi,
>>
>> recently I learned about Project Euler (http://projecteuler.net/) and now
>> I'm trying to work me through. At the moment I'm thinking about
On Tue, Feb 3, 2009 at 4:17 PM, H.G. le Roy wrote:
> Hi,
>
> recently I learned about Project Euler (http://projecteuler.net/) and now
> I'm trying to work me through. At the moment I'm thinking about
> http://projecteuler.net/index.php?section=problems&id=8
>
> One step for my solution should be
On Tue, Feb 3, 2009 at 2:46 PM, prasad rao wrote:
> hi
>>Right now you skip by x+((len(v))/columns)
>>which will be different for each row.
> How is it possible. len(v)=98.A constant.
> Is it not.
> Does len(v) changes with each iteration?
No, but x does.
--
André Engels, andreeng...@gmail.com
On Tue, Feb 3, 2009 at 11:40 AM, prasad rao wrote:
> hi
a=2.1
a%1==True
> False
a%1==False
> False
b=3.8
b%1==True
> False
b%1==False
> False
> If it gives correct bool, it could be put to good use.
== gives a high degree of equality. In your idea, it would not be a
On Tue, Feb 3, 2009 at 3:59 AM, WM. wrote:
> # program to find square root
> square = float(raw_input ("Please enter a number to be rooted, "))
> guess = input("Please guess at the root, ")
> i = 0
> while guess**2 != square:
>i+=1
># Newton's formula
>guess = guess - (gues
On Sat, Jan 31, 2009 at 5:57 PM, Tim Johnson wrote:
> Using python 2.5.1
>
> If I create a class a
>
> class a:
>
> pass
>
> initialize o as:
>
> o=a
>
> and call
>
> isinstance(o,a)
>
> the return value is True.
Actually, it is false. To make it true, you have to do o=a() rather than o=a
> Is t
1 - 100 of 187 matches
Mail list logo