Re: [Tutor] Video file metadata? (MP4/WMV)

2008-03-04 Thread Allen Fowler
I can't seem to find a simple description of the MP4 sepc... it might be because there is not one. :) That being said, what is the correct way to parse binary files in Python? - Original Message > From: Alan Gauld <[EMAIL PROTECTED]> > To: tutor@python.org > Sent: Tuesday, March 4, 2

Re: [Tutor] Python and displaying mathematical equations?

2008-03-04 Thread Shuai Jiang (Runiteking1)
Never even knew about MathML... stupid me. My Firefox browser can't handle the MathML test page quite well, can't show the root sign. Thank you very much! On Mon, Mar 3, 2008 at 9:15 PM, John Fouhy <[EMAIL PROTECTED]> wrote: > On 04/03/2008, Shuai Jiang (Runiteking1) <[EMAIL PROTECTED]> wrote: >

Re: [Tutor] Translate this VB.NET code into Python for me?

2008-03-04 Thread Dick Moores
At 10:05 AM 3/4/2008, Alan Gauld wrote: >"Dick Moores" <[EMAIL PROTECTED]> wrote in message >news:[EMAIL PROTECTED] > >I thought I'd dip into .NET by downloading the free Microsoft Visual > > Basic 2005 Express Edition, and start working through _Beginning > > Visual Basic 2005 Express Edition_, by

Re: [Tutor] Translate this VB.NET code into Python for me?

2008-03-04 Thread Dick Moores
At 07:10 AM 3/4/2008, Jerry Hill wrote: >On Tue, Mar 4, 2008 at 8:05 AM, Dick Moores <[EMAIL PROTECTED]> wrote: > > By the second chapter I've begun to suspect that GUIs aside, Python > > is a lot simpler to write. Could someone prove that to me by > > translating the code I've pasted at > >

Re: [Tutor] Video file metadata? (MP4/WMV)

2008-03-04 Thread Alan Gauld
"Allen Fowler" <[EMAIL PROTECTED]> wrote in > 1) Does these exist a python module I can use to > programatically edit the metadata in MP4 > files? I don;t know of one but if you can find the spec it might be easy enough to just edit the files using normal (binary) file handling methods. I'

Re: [Tutor] help with slice

2008-03-04 Thread Alan Gauld
"Ole Henning Jensen" <[EMAIL PROTECTED]> wrote > What you need to do is loop all the way through your list and then > only > do something to every third element in the list That's not quite what the OP asked for, he wanted the third element from every sublist in the master list > This is an exa

Re: [Tutor] help with slice

2008-03-04 Thread Alan Gauld
"washakie" <[EMAIL PROTECTED]> wrote > Could someone please explain 'slices' also for dictionaries? So far as I know slices don;t work for dictionaries directly - dictionaries don't have the concept of order. However you could get a list of keys and apply a slice to that, although I'm not sure

Re: [Tutor] help with slice

2008-03-04 Thread bob gailer
bob gailer wrote: > washakie wrote: > >> Could someone please explain 'slices' also for dictionaries? >> >> basically, I'd like to know how you would call every 3rd element in a list >> of lists... >> Call? Do you mean that these elements are callable objects (e.g. functions) which you wa

Re: [Tutor] help with slice

2008-03-04 Thread bob gailer
washakie wrote: > Could someone please explain 'slices' also for dictionaries? > > basically, I'd like to know how you would call every 3rd element in a list > of lists... > > My logic says: ThirdElems=List[:][2] > > Which to me reads, for every item in List (which are lists), return the > third i

Re: [Tutor] help with slice

2008-03-04 Thread Ole Henning Jensen
> Could someone please explain 'slices' also for dictionaries? > > basically, I'd like to know how you would call every 3rd element in a list > of lists... > > My logic says: ThirdElems=List[:][2] > What this does is, just assign the 3 value of List to the variable. look at this way, step by st

Re: [Tutor] Video file metadata? (MP4/WMV)

2008-03-04 Thread Andreas Kostyrka
Don't think so. Do you have any cmdline tool to update the meta data? Alternativly you can naturally embed Win32 components and control them with Python, but I'm not a Windows guy. Andreas Am Dienstag, den 04.03.2008, 14:10 -0800 schrieb Allen Fowler: > Hello, > > I have several hundred WMV vi

Re: [Tutor] help with slice

2008-03-04 Thread Andreas Kostyrka
What you probably want is: [elem_list[2] for elem_list in List] If you are not sure that the list have at least three elements, you can use something like this: [(elem_list + [None, None, None])[2] for elem_list in List] Which will use None as a default value. Andreas Am Dienstag, den 04.03.2

[Tutor] Video file metadata? (MP4/WMV)

2008-03-04 Thread Allen Fowler
Hello, I have several hundred WMV video files with bad embedded author/title/date information. However, the correct information is correctly encoded in the file name.. i.e. "title-author-date.wmv" Seems like the a great job for Python. :) Also, I am about to convert these fiiles to MP4 f

[Tutor] help with slice

2008-03-04 Thread washakie
Could someone please explain 'slices' also for dictionaries? basically, I'd like to know how you would call every 3rd element in a list of lists... My logic says: ThirdElems=List[:][2] Which to me reads, for every item in List (which are lists), return the third item. but this doesn't work. T

Re: [Tutor] Translate this VB.NET code into Python for me?

2008-03-04 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I thought I'd dip into .NET by downloading the free Microsoft Visual > Basic 2005 Express Edition, and start working through _Beginning > Visual Basic 2005 Express Edition_, by Peter Wright (Apress). > > By the second chapt

Re: [Tutor] Translate this VB.NET code into Python for me?

2008-03-04 Thread Jerry Hill
On Tue, Mar 4, 2008 at 8:05 AM, Dick Moores <[EMAIL PROTECTED]> wrote: > By the second chapter I've begun to suspect that GUIs aside, Python > is a lot simpler to write. Could someone prove that to me by > translating the code I've pasted at > (from p

[Tutor] Translate this VB.NET code into Python for me?

2008-03-04 Thread Dick Moores
I thought I'd dip into .NET by downloading the free Microsoft Visual Basic 2005 Express Edition, and start working through _Beginning Visual Basic 2005 Express Edition_, by Peter Wright (Apress). By the second chapter I've begun to suspect that GUIs aside, Python is a lot simpler to write. Coul

Re: [Tutor] sorting objects on two attributes

2008-03-04 Thread Kent Johnson
Here is a version based on Andreas' solution using groupby() that avoids the decorate-undecorate by using the key= parameter for the second sort: l.sort(key=lambda x: (x.content_type, x.submit_date)) t = [ list(items) for key, items in itertools.groupby(l, key=lambda x: (x.content_type)) ] t.sort