Re: [Tutor] how can I compare a local directory or file with a remote one

2007-06-20 Thread Reed O'Brien
On Jun 20, 2007, at 2:03 PM, Richard Querin wrote: > I'm interested in writing a quick script that would run a diff-type > command that would compare a local directory to a remote one to > identify the changes in the files within that directory. > > I was initially thinking that I would maybe use

Re: [Tutor] AttributeError: 'list' object has no attribute 'capitalize'

2007-06-20 Thread John Fouhy
On 20/06/07, Norman Khine <[EMAIL PROTECTED]> wrote: > My question is how to get all the words in the string to start with > capital letter? Hmm, well the title() function is a new one to me :-) More generally, if we have raw = 'one two three', then I would have done it using raw.split(). i.e.

Re: [Tutor] sorting lists into sub lists based on a key

2007-06-20 Thread Kent Johnson
Iyer wrote: > if I have a list of lists, that goes like this: > [[0,['a','b']],[0,['c','d']],[3,['f','g']], [0,['a','b']],[0,['c','d']], > [3,['f1','f2']], [2,['zz','dd']]] > > what could be the best way to reorder this such that the sublists with > the same first element go into their own sub-

[Tutor] sorting lists into sub lists based on a key

2007-06-20 Thread Iyer
if I have a list of lists, that goes like this: [[0,['a','b']],[0,['c','d']],[3,['f','g']], [0,['a','b']],[0,['c','d']], [3,['f1','f2']], [2,['zz','dd']]] what could be the best way to reorder this such that the sublists with the same first element go into their own sub-list ? like, sublist0

Re: [Tutor] how can I compare a local directory or file with a remote one

2007-06-20 Thread Norman Khine
It depends what you want to compare. Here we use Git http://git.or.cz/ it is written in python and basically you can have two repositories on the different machines, and track the changes. Obviously if you make a change on a file, this change has to be commited before it can be accounted for. perha

Re: [Tutor] how can I compare a local directory or file with a remote one

2007-06-20 Thread Kent Johnson
Richard Querin wrote: > I'm interested in writing a quick script that would run a diff-type > command that would compare a local directory to a remote one to > identify the changes in the files within that directory. > > I was initially thinking that I would maybe use the linux diff command > in c

Re: [Tutor] how can I compare a local directory or file with a remoteone

2007-06-20 Thread Alan Gauld
"Richard Querin" <[EMAIL PROTECTED]> wrote > I was initially thinking that I would maybe use the linux diff > command > in conjunction with the wget command (or something similar) to > create > a local copy but that involves downloading files. Is there any way > in > python to do a similar thin

Re: [Tutor] how can I compare a local directory or file with a remote one

2007-06-20 Thread Tom Tucker
What are we comparing? Size of files, number of files in a directory, md5sum of the files, directory size, etc? What about rsync? You can use rsync to compare directories between a source and destiantion system and just report differences. For example, comparing /etc directores between two RHEL

Re: [Tutor] How do I delete all Files of certain extension type?

2007-06-20 Thread Kent Johnson
Mike Hoy wrote: > I have a phonebook program that creates .pb files for each entry that is > created. One of the features of the program will be to allow the user to > delete all of the .pb files in the directory. For simplicity I was just > going to have it delete all the .pb files in the same

Re: [Tutor] How do I delete all Files of certain extension type?

2007-06-20 Thread F.Lee
On 6/20/07, Mike Hoy <[EMAIL PROTECTED]> wrote: > I have a phonebook program that creates .pb files for each entry that is > created. One of the features of the program will be to allow the user to > delete all of the .pb files in the directory. For simplicity I was just > going to have it delete a

[Tutor] how can I compare a local directory or file with a remote one

2007-06-20 Thread Richard Querin
I'm interested in writing a quick script that would run a diff-type command that would compare a local directory to a remote one to identify the changes in the files within that directory. I was initially thinking that I would maybe use the linux diff command in conjunction with the wget command (

[Tutor] How do I delete all Files of certain extension type?

2007-06-20 Thread Mike Hoy
I have a phonebook program that creates .pb files for each entry that is created. One of the features of the program will be to allow the user to delete all of the .pb files in the directory. For simplicity I was just going to have it delete all the .pb files in the same directory I was working

Re: [Tutor] List within Dictionary

2007-06-20 Thread Kent Johnson
pearl jb wrote: > I wanted to know "How to access the list elements which is in Dictionary" > > dict = {'John':['ph=919873673','res=91928827737'] , 'William' : > ['ph=91983763','res=91837474848'] } > > > I want the output to be > > 1. John res=91928827737 > 2. William ph=91983763 You can use

Re: [Tutor] AttributeError: 'list' object has no attribute 'capitalize'

2007-06-20 Thread Norman Khine
thanks, it is as easy as that ;) Adam A. Zajac wrote: > On Wed, 20 Jun 2007 12:32:53 +0200 > > Norman Khine <[EMAIL PROTECTED]> wrote: > >> My question is how to get all the words in the string to start with >> capital letter? > title() should do it > a = "hello world" a.title()

Re: [Tutor] AttributeError: 'list' object has no attribute 'capitalize'

2007-06-20 Thread Adam A. Zajac
On Wed, 20 Jun 2007 12:32:53 +0200 Norman Khine <[EMAIL PROTECTED]> wrote: > My question is how to get all the words in the string to start with > capital letter? title() should do it >>>a = "hello world" >>>a.title() >>>'Hello World' ___ Tutor maillis

[Tutor] List within Dictionary

2007-06-20 Thread pearl jb
I wanted to know "How to access the list elements which is in Dictionary" dict = {'John':['ph=919873673','res=91928827737'] , 'William' : ['ph=91983763','res=91837474848'] } I want the output to be 1. John res=91928827737 2. William ph=91983763 - On

[Tutor] AttributeError: 'list' object has no attribute 'capitalize'

2007-06-20 Thread Norman Khine
Hello, I would like to capitalize each word from an input form. The problem is that the input form can be added as: "HELLO world" "hello world" "HELLO WORLD" etc.. If I do this: >>> string = "HELLO world" >>> print string.capitalize() Hello world >>> only the first word gets capitalized. My

Re: [Tutor] tips for writing a program

2007-06-20 Thread Alan Gauld
"Mat Newport" <[EMAIL PROTECTED]> wrote > Basically the program would scan a specified folder, > build a list of specific files (.txt in the example below), Look at the glob module and its glob function. Or if you want to include subdirectories lkook at the os.walk function. There are example