Re: [Tutor] optimize a plot

2011-11-16 Thread lina
On Wed, Nov 16, 2011 at 1:51 AM, Alan Gauld wrote: > On 15/11/11 14:34, lina wrote: >> >> Sorry for some not mature questions asked before, fixed now by: >> >> def PlotPathway(list1): >> >>     for i in range(len(list1)): >>            for j in range(len(list1[i])-1): >>                    if list

Re: [Tutor] IndentationError:

2011-11-16 Thread Dario Lopez-Kästen
The indentation is indeed off: Original code: def PlotPathway(list1): for i in range(len(list1)): for j in range(len(list1[i])-1): if list1[i][j] != list1[i][j+1]: g.add_edge(list1[i][j], list1[i][j+1]) if list1[i][j]<=42:

Re: [Tutor] IndentationError:

2011-11-16 Thread lina
On Wed, Nov 16, 2011 at 4:06 PM, Dario Lopez-Kästen wrote: > The indentation is indeed off: > Original code: > def PlotPathway(list1): >    for i in range(len(list1)): >        for j in range(len(list1[i])-1): >                    if list1[i][j] != list1[i][j+1]: >                        g.add_edg

Re: [Tutor] IndentationError:

2011-11-16 Thread Andre Engels
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

[Tutor] binary file query

2011-11-16 Thread Shirkhedkar, Dhanashri
If we are opening a binary file in python then do we have to use "Import struct" and do "struct.unpack" to work on the data from that binary file? Will we be able to process the file as text file without using struct? Thanks, Dhanashri ___ Tutor

[Tutor] Bulk Import Script Help Please

2011-11-16 Thread Amir
> Hi, > > > > I am new to python, and I need to bulk import a csv data dump into our > content management system, Equella. > > > > I need to bulk import the CSV file dump into Equella to create a Taxonomy > using a Python script. > > > > I would really appreciate any help someone can

Re: [Tutor] IndentationError:

2011-11-16 Thread lina
On Wed, Nov 16, 2011 at 4:31 PM, Andre Engels wrote: > 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 > >    

[Tutor] Running windows media player

2011-11-16 Thread MD.Mahbubur Rahman
Hello friends, I need to run mp3/ogg files with Windows Media Player from a python script. I have the following code which only can start Windows Media Player. But I dont know how to run a mp3/ogg file with this instance of Windows Media Player: from pywinauto import application app = applicati

Re: [Tutor] Running windows media player

2011-11-16 Thread Timo
Op 15-11-11 04:29, MD.Mahbubur Rahman schreef: Hello friends, I need to run mp3/ogg files with Windows Media Player from a python script. I have the following code which only can start Windows Media Player. But I dont know how to run a mp3/ogg file with this instance of Windows Media Player: I do

Re: [Tutor] IndentationError:

2011-11-16 Thread Timo
Op 16-11-11 09:46, lina schreef: On Wed, Nov 16, 2011 at 4:31 PM, Andre Engels wrote: 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? T

Re: [Tutor] binary file query

2011-11-16 Thread Alan Gauld
On 14/11/11 05:34, Shirkhedkar, Dhanashri wrote: If we are opening a binary file in python then do we have to use “Import struct” and do “struct.unpack” to work on the data from that binary file? That depends but in general the answer is no. But it all depends on what is in the file. If it is a

Re: [Tutor] Bulk Import Script Help Please

2011-11-16 Thread Alan Gauld
On 10/11/11 17:10, Amir wrote: I am new to python, and I need to bulk import a csv data dump into our content management system, Equella. OK, we can definitely help with the Python, the Equella bit will likely need a more specialised forum. What is your background? Can you already program i

[Tutor] Thank you!

2011-11-16 Thread Cranky Frankie
Thank you to all for your help on my SQL DDL parsing script, and thank you Alan for having this wonderful list. I got the program to work and verified the DDL is being parsed correctly. I've been working as a database administrator for many years, but before that I programmed on the mainframe. I'm

Re: [Tutor] list of objects?

2011-11-16 Thread bob gailer
Please always reply-all so a copy goes to the list. Am forwarding this on your behalf. I will reply this afternoon. On 11/16/2011 7:18 AM, Elwin Estle wrote: Part of the reason I am writing this program is to learn OOP, hence the use of classes. Most of what little programming background I ha

Re: [Tutor] Clock in tkinter?

2011-11-16 Thread Mic
Hi! It is no homework, in fact am I working ahead of class. I have now, after five minutes thinking, solved my problem, but a new problem has risen. But to begin with, here is how I solved the problem: from tkinter import* import time the_time='' class Window(Frame): def __init__(self,m

Re: [Tutor] Clock in tkinter?

2011-11-16 Thread Mic
Thank you Yes, wise statement. Mic From: Asokan Pichai Sent: Wednesday, November 16, 2011 5:17 AM To: Mic Cc: tutor@python.org Subject: Re: [Tutor] Clock in tkinter? > On Wed, Nov 16, 2011 at 1:30 AM, Mic wrote: > Hi! > I am new to programming WELCOME! >and I hop this question isn’t stup

[Tutor] modulus

2011-11-16 Thread ADRIAN KELLY
Please can anyone tell me how i can print this without all the brackets and commas, i know i need the modulus symbol but i dont know how it works. any advice would be appreciated regards adrian def arguments(): name=raw_input ("Please enter your firstname: ") surname=raw_input ("Ent

Re: [Tutor] modulus

2011-11-16 Thread Wayne Werner
On Wed, Nov 16, 2011 at 9:46 AM, ADRIAN KELLY wrote: > Please can anyone tell me how i can print this without all the brackets > and commas, i know i need the modulus symbol but i dont know how it works. > any advice would be appreciated > > regards > adrian > > def arguments(): > name=raw_in

Re: [Tutor] modulus

2011-11-16 Thread Steven D'Aprano
ADRIAN KELLY wrote: Please can anyone tell me how i can print this without all the brackets and commas, i know i need the modulus symbol but i dont know how it works. any advice would be appreciated regards adrian def arguments(): name=raw_input ("Please enter your firstname: ") su

Re: [Tutor] modulus

2011-11-16 Thread Steven D'Aprano
Wayne Werner wrote: In this case it's not actually modulus, it's just the syntax for string formatting. I'm not sure *what* the reasoning behind the % was, but that's the way it is. I believe the designers of the C programming language are to blame. [...] In old style formatting, you use a s

Re: [Tutor] modulus

2011-11-16 Thread ADRIAN KELLY
really appreciate that answer thanks very much.. Adrian Kelly 1 Bramble Close Baylough Athlone County Westmeath 0879495663 From: waynejwer...@gmail.com Date: Wed, 16 Nov 2011 09:59:50 -0600 Subject: Re: [Tutor] modulus To: kellyadr...@hotmail.com CC: tutor@python.org On Wed

Re: [Tutor] Clock in tkinter?

2011-11-16 Thread Wayne Werner
On Wed, Nov 16, 2011 at 9:28 AM, Mic wrote: > Hi! > It is no homework, in fact am I working ahead of class. I have now, after > five minutes thinking, solved my problem, but a new problem has risen. > But to begin with, here is how I solved the problem: > > > > from tkinter import* > import tim

Re: [Tutor] modulus

2011-11-16 Thread Wayne Werner
On Wed, Nov 16, 2011 at 10:09 AM, Steven D'Aprano wrote: > Wayne Werner wrote: > > >> In old style formatting, you use a string with format specifiers (%s, %d, >> etc.) followed by a tuple of arguments. Here, the lengths have to match >> exactly - if you have one specifier then you must have a 1-

Re: [Tutor] Clock in tkinter?

2011-11-16 Thread Mic
Thanks for your quick answer. Hmm, I never thought that didn’t have to use a global variable. When you mentioned time.localtime() method, did you mean that I should convert the time to numbers and then write an if statement? Like, say that I make 1 hour equivalent to the integear clock= 1. Then

Re: [Tutor] binary file query

2011-11-16 Thread Prasad, Ramit
>If we are opening a binary file in python then do we have to use "Import >struct" and do "struct.unpack" to work on the data from that binary file? >Will we be able to process the file as text file without using struct? You should open the file with the 'rb' parameter and then read from it as yo

Re: [Tutor] Clock in tkinter?

2011-11-16 Thread Wayne Werner
On Wed, Nov 16, 2011 at 10:59 AM, Mic wrote: > Thanks for your quick answer. Hmm, I never thought that didn’t have to > use a global variable. > That's often the point of using classes - you want to collect related data and functions in one place. In this case, you're creating a clock widget,

Re: [Tutor] Clock in tkinter?

2011-11-16 Thread Mic
Okay, that is good to know. Yes, I here is how I solved my problem: def print_hi_15_00(): time1=int(time.strftime('%H')) if time1>15: print("hi") That worked fine. However, if the time is say 15, I want it print 16 instead. And if the time is 16, I want it to print 17 i

Re: [Tutor] Clock in tkinter?

2011-11-16 Thread Dave Angel
Top-posting is what I'm doing here. Putting my remarks BEFORE the part I'm quoting. On 11/16/2011 12:44 PM, Mic wrote: Oh, by top-posting you mean that I include everything I have written before in my post, and that it is no good to do? So I just post what I wrote, and nothing from earli

Re: [Tutor] Multiple threads

2011-11-16 Thread Dave Angel
(You're top-posting. Put your remarks AFTER what you're quoting) On 11/16/2011 12:52 PM, Jack Keegan wrote: Ok, I thought that processes would do the same job as threads. So would the general rule be some thing like so: If I want another piece of work to run (theoretically) along side my main

Re: [Tutor] Thank you!

2011-11-16 Thread Alan Gauld
On 16/11/11 13:50, Cranky Frankie wrote: Thank you to all for your help on my SQL DDL parsing script, and thank you Alan for having this wonderful list. Not much to do with me I'm just one the moderators who happens to flush the admin queue occasionally! :-) before that I programmed on the m

Re: [Tutor] Clock in tkinter?

2011-11-16 Thread Wayne Werner
On Wed, Nov 16, 2011 at 11:44 AM, Mic wrote: > I wonder if you have any suggestions regarding how to place widgets in > my window. > Even though I try to arrange them as orderly as possible they get placed > at all different kind of places in the window. > I use the grid method and place them

[Tutor] Tutor Ilde running problems

2011-11-16 Thread Nidian Job-Smith
Hi all, Just installed python 2.7.2 on my windows 7 32-bit laptop. However when I attempt to run idle it wont open (nothing happens) Wondered if any of you have had this problem and have any tips? Cheers> ___ > Tutor maillist - Tutor@python.org > To u

Re: [Tutor] Tutor Ilde running problems

2011-11-16 Thread Wayne Werner
On Wed, Nov 16, 2011 at 1:41 PM, Nidian Job-Smith wrote: > Hi all, > > Just installed python 2.7.2 on my windows 7 32-bit laptop. However > when I attempt to run idle it wont open (nothing happens) > > Wondered if any of you have had this problem and have any tips? > This is more of a Windows is

[Tutor] format integer to currency

2011-11-16 Thread ADRIAN KELLY
print ("i own {0:.2f} {1}".format(1.1,"million")) can anyone help me with code to change the format of this to currency €1.10 million thanks for your help ___ Tutor maillist - Tutor@python.org To unsubscrib

Re: [Tutor] format integer to currency

2011-11-16 Thread Steven D'Aprano
ADRIAN KELLY wrote: print ("i own {0:.2f} {1}".format(1.1,"million")) can anyone help me with code to change the format of this to currency €1.10 million thanks for your help # Python 2.6 or 2.7 print (u"I own €{0:.2f} {1}".format(1.1, "million")) # Python 3 print ("I own €{0:.2f} {1}".for

Re: [Tutor] modulus

2011-11-16 Thread Steven D'Aprano
Wayne Werner wrote: On Wed, Nov 16, 2011 at 10:09 AM, Steven D'Aprano wrote: Wayne Werner wrote: In old style formatting, you use a string with format specifiers (%s, %d, etc.) followed by a tuple of arguments. Here, the lengths have to match exactly - if you have one specifier then you must

Re: [Tutor] modulus

2011-11-16 Thread Wayne Werner
On Wed, Nov 16, 2011 at 4:04 PM, Steven D'Aprano wrote: > Wayne Werner wrote: > >> It was explained to me once that in > > this case: >> >> "%s" % 42 >> >> That since python expects to see a single-element tuple it treats it as or >> converts 42 to a single element tuple. >> > > "Treats as" may

[Tutor] change values in an array

2011-11-16 Thread questions anon
I am trying to do something really simple. I have a numpy array and if any values in the array are 255 I want to change them to 1. but I can't seem to get anything to work! If I use: for i, value in enumerate(mask_arr): if value==255: mask_arr[i]=1 I get this error: Traceback (most