Re: OT: unix newbie questions

2006-06-06 Thread Fredrik Lundh
Carlos Lopez wrote: Please help i am losing my mind ... UNIX Newbee *23. How do you add a line to the end of an existing file myfile with date stamp. (1) * f = open(myfile, a+) f.write(datestamp) f.close() *24. Display recent 10 java files, (with *.java extension) , in descending

Re: OT: unix newbie questions

2006-06-06 Thread Fredrik Lundh
Fredrik Lundh wrote: *24. Display recent 10 java files, (with *.java extension) , in descending order by time, latest to oldest time. (1) * files = sorted(glob.glob(*.py), key=os.path.getmtime)[-10:] files.reverse() (to display the files, use print) /F --

Re: OT: unix newbie questions

2006-06-06 Thread Maric Michaud
Le Mardi 06 Juin 2006 08:36, Fredrik Lundh a écrit : *26. You observed that some of your group members are fiddling with your file  myfile and you wanted to remove the read permission to your group. How do you do? (1)   os.chmod(myfile.txt, 0404) rather, os.chmod(myfile.txt, 0400) I

Re: OT: unix newbie questions

2006-04-05 Thread Lawrence D'Oliveiro
In article [EMAIL PROTECTED], Gerard Flanagan [EMAIL PROTECTED] wrote: * To create an empty __init__.py file I do 'vim __init__.py' then immediately exit vim, is there a shell or vim command which will create an empty file without opening the editor? man touch * If I want to do :

Re: OT: unix newbie questions

2006-04-05 Thread flamesrock
Another option is zsh, which is very much like bash, but better ;) -- http://mail.python.org/mailman/listinfo/python-list

Re: OT: unix newbie questions

2006-03-27 Thread Inyeol Lee
On Sat, Mar 25, 2006 at 03:45:56AM -0800, Gerard Flanagan wrote: [...] * If I want to do : mv mypackage-1.0.2.tar.gz subdir/mypackage-1.0.2.tar.gz then tab-completion gives me the first occurrence of the file, but I have to type the second occurrence - is there a way of not

Re: OT: unix newbie questions

2006-03-26 Thread Joel Hedlund
* I'm using the tcsh shell and have no problems with it, but bash seems more popular - any reason to change? (I don't intend writing many shell scripts) You can do this in bash: $ python myprog stdout.txt 2 stderr.txt and have output to sys.stdout and sys.stderr go in separate files.

Re: OT: unix newbie questions

2006-03-25 Thread Rene Pijlman
Gerard Flanagan: * To create an empty __init__.py file I do 'vim __init__.py' then immediately exit vim, is there a shell or vim command which will create an empty file without opening the editor? touch __init__.py * cd ~ brings me to my home directory, is there a means by which I can set up a

Re: OT: unix newbie questions

2006-03-25 Thread Diez B. Roggisch
* If I want to do : mv mypackage-1.0.2.tar.gz subdir/mypackage-1.0.2.tar.gz then tab-completion gives me the first occurrence of the file, but I have to type the second occurrence - is there a way of not having to type it? No need to give it the name the second time. #