[Tutor] Python video?

2006-04-12 Thread Hoffmann
Hi, I read this week on this forum about a kind of Python video in its website. Which view is that, and where could I find it? I search in Python website, but I didn't find it. Is it a 'demo' of the language? Thanks, Hoffmann __ Do You Yahoo!? Tired

Re: [Tutor] Problems when displaying numbers

2006-04-12 Thread w chun
hi patricia, it would be really helpful to see an example of 'result' before and after the call to calc_numbers() as well as the code for calc_numbers if possible. this will likely reveal the problem that you are having. thanks, -wesley On 4/12/06, Patricia <[EMAIL PROTECTED]> wrote: > Hi, > >

Re: [Tutor] String question.

2006-04-12 Thread Kent Johnson
Carlos Benevides wrote: > All, > > I have a problem/question I'd like to pose to you guys on how best to > accomplish the following. I have a string that will vary in size, what > I would like to do is split into n size chunks. I am also not sure how > best to represent the chunks. For examp

[Tutor] String question.

2006-04-12 Thread Carlos Benevides
All, I have a problem/question I'd like to pose to you guys on how best to accomplish the following. I have a string that will vary in size, what I would like to do is split into n size chunks. I am also not sure how best to represent the chunks. For example, say I have a len(s) = 200 chars

Re: [Tutor] failing to learn python

2006-04-12 Thread Alan Gauld
> the best tools. If you know shell, egrep and awk, they are probably better > than Python at doing the things they do. > > For me, I don't know those specialized tools and I have chosen not to > learn them because I don't often need their capabilities and Python can do > what they do. I must a

Re: [Tutor] failing to learn python

2006-04-12 Thread Alan Gauld
> can I use Python. Everyone says it is a "general programming language", > but what in the world is a "general programming language"? Others have already answered this. I'll add a few other comments. A general purpose language is one that in theory means you don't need any others. It can do any

[Tutor] Problems when displaying numbers

2006-04-12 Thread Patricia
Hi, This is my code: conn = MySQLdb.connect(host = "localhost", user = "root", passwd = "", db ="mydb") cursor = conn.cursor() cursor.execute("""SELECT h, k, l, m, s, t FROM targets WHERE target_name = %s""", (target)) result = cursor.fetchone() alist = helperfunc.calc_n

Re: [Tutor] n00b question: dictionaries and functions.

2006-04-12 Thread Danny Yoo
On Wed, 12 Apr 2006, Jesse wrote: > def add(): >x = float(raw_input("Enter a number: ")) >y = float(raw_input("And a second number: ")) >print x + y > def subtract(): >x = float(raw_input("Enter a number: ")) >y = float(raw_input("And a second number: ")) >print x - y > >

Re: [Tutor] n00b question: dictionaries and functions.

2006-04-12 Thread Bob Gailer
Jesse wrote: > Hey, this should be an easy question for you guys. I'm writing my > first program (which Bob, Alan, and Danny have already helped me > with--thanks, guys!), and I'm trying to create a simple command-line > interface. I have a good portion of the program's "core functions" > alrea

[Tutor] n00b question: dictionaries and functions.

2006-04-12 Thread Jesse
Hey, this should be an easy question for you guys. I'm writing my first program (which Bob, Alan, and Danny have already helped me with--thanks, guys!), and I'm trying to create a simple command-line interface. I have a good portion of the program's "core functions" already written, and I want to c

Re: [Tutor] failing to learn python

2006-04-12 Thread Danny Yoo
On Wed, 12 Apr 2006, Payal Rathod wrote: > can I use Python. Everyone says it is a "general programming language", > but what in the world is a "general programming language"? One idea behind a "general purpose programming language" is that it's not specialized toward anything in particular.

Re: [Tutor] Explanation of Lists data Type

2006-04-12 Thread Alan Gauld
Kaushal, > 8.7 List slices You might find it worth going through the official tutor section on slicing, it explains the various forms quite well. >>> list[:4] --> Does this mean its list[0:4] Sort of, it means from *the beginning* to 4. >>> list[3:] --> Does this mean its list[3:0] No it

Re: [Tutor] Tuples / Critique of How to Think like a Computer Scientist[Was: Re: Tuples]

2006-04-12 Thread Alan Gauld
> I'm going to rant, but not at you, but at that particular tutorial you're > reading. To the others on the list: frankly, I really do not like the > approach that "How to Think like a Computer Scientist" uses in marching > through all the concepts it tries to teach; in a critical eye, I would

Re: [Tutor] dictionary datatype

2006-04-12 Thread Alan Gauld
> For example, I have a dictionary: > dict1 = { 0x2018:u'k', 0x2019:u'd'} > > I assign: > n = 0x2018 > print dict1[n] > > Then: > KeyError: '0x2018' The error is complaining that you are using a string as a key. Are you sure you aren't assigning n = '0x2018' Alan G Author of the learn to progr

Re: [Tutor] dictionary datatype

2006-04-12 Thread Hugo González Monteverde
kakada wrote: > I assign: > n = 0x2018 > print dict1[n] > > Then: > KeyError: '0x2018' > Notice the error menstions a *string*. You probably mistyped it, not in the email, but in your actual program. Hugo ___ Tutor maillist - Tutor@python.org http

Re: [Tutor] encoding

2006-04-12 Thread Hugo González Monteverde
kakada wrote: > LookupError: unknown encoding: ANSI > > so what is the correct way to do it? > stringinput.encode('latin_1') works for me. Do a Google search for Python encodings, and you will find what the right names for the encodings are. http://docs.python.org/lib/standard-encodings.ht

Re: [Tutor] failing to learn python

2006-04-12 Thread Kent Johnson
Payal Rathod wrote: > On Tue, Apr 11, 2006 at 07:35:15PM +0100, Alan Gauld wrote: >> Python is a general programmjing language great for bigger jobs. If > > But what does Python excel at. That si my main question. Whatevfer I > think of I can already do or know a way to do in shell. I am not ge

Re: [Tutor] failing to learn python

2006-04-12 Thread Payal Rathod
On Tue, Apr 11, 2006 at 07:35:15PM +0100, Alan Gauld wrote: > Python is a general programmjing language great for bigger jobs. If But what does Python excel at. That si my main question. Whatevfer I think of I can already do or know a way to do in shell. I am not getting where would I need Pyt

Re: [Tutor] dictionary datatype

2006-04-12 Thread kakada
It also works for me now:) First i tried it with Konsole in Kate and it's not working. It sometimes happen with assignment statement: i += 1 (not working) i+= 1(working) but later on I tested it again and both are working. Thanks for your help, though. da Jason Massey wrote: > Works for

Re: [Tutor] Extending a list within a list comprehension

2006-04-12 Thread Kent Johnson
Victor Bouffier wrote: > On Tue, 2006-04-11 at 22:17 -0400, Kent Johnson wrote: >> Victor Bouffier wrote: >> >>> If the second element in each array passed as x is of variable length >>> (that is, it has a different element count than three, in this case), >>> the program needs to extend the list i

Re: [Tutor] Explanation of Lists data Type

2006-04-12 Thread Noufal Ibrahim
On Wed, April 12, 2006 2:42 pm, Kaushal Shriyan wrote: list[:] --> Does this mean its list[0:0] > ['a', 'b', 'c', 'd', 'e', 'f'] > I didnot understood this I remember you once asked another question related to sequence slices and I mentioned the effects of slicing with no indices. You

Re: [Tutor] Explanation of Lists data Type

2006-04-12 Thread Pujo Aji
Sorry for the last explanationsthere is a correction!On 4/12/06, Pujo Aji <[EMAIL PROTECTED]> wrote: Hello, On 4/12/06, Kaushal Shriyan <[EMAIL PROTECTED] > wrote: Hi AllI am referring to http://www.ibiblio.org/obp/thinkCSpy/chap08.htm 8.7 List slices

Re: [Tutor] Explanation of Lists data Type

2006-04-12 Thread Pujo Aji
Hello,On 4/12/06, Kaushal Shriyan <[EMAIL PROTECTED]> wrote: Hi AllI am referring to http://www.ibiblio.org/obp/thinkCSpy/chap08.htm8.7 List slices>>> list = ['a', 'b', 'c', 'd', 'e', 'f'] >>> list[1:3]['b', 'c']  -> I understood this  >>> list[:4]  -

[Tutor] Explanation of Lists data Type

2006-04-12 Thread Kaushal Shriyan
Hi All I am referring to http://www.ibiblio.org/obp/thinkCSpy/chap08.htm 8.7 List slices >>> list = ['a', 'b', 'c', 'd', 'e', 'f'] >>> list[1:3] ['b', 'c'] -> I understood this >>> list[:4] --> Does this mean its list[0:4] ['a', 'b', 'c', 'd']

[Tutor] Tuples / Critique of How to Think like a Computer Scientist [Was: Re: Tuples]

2006-04-12 Thread Danny Yoo
On Wed, 12 Apr 2006, Kaushal Shriyan wrote: > I am referring to http://www.ibiblio.org/obp/thinkCSpy/chap09.htm > I did not understood the below Section at all :( Hi Kaushal, Ok, let's trying starting somewhere else and see at what point you get stuck. It'll also give you a chance to practic