Displaying keyword search results 1 - 4
Created by Dr. Xi on May 05, 2009 19:59:21 Last update: May 05, 2009 19:59:21
Delete a single file:
>>> import os >>> file = 'myfile' >>> os.rem...Delete a directory and contents:
>>> import shutil >>> dir(shutil) ['Error', ...
Created by Dr. Xi on November 17, 2008 03:33:28 Last update: November 17, 2008 03:33:28
The __file__ attribute of a module tells you where a module come from:
>>> import pkg_resources >>> pkg_resources.__fi...
Created by Dr. Xi on September 25, 2008 23:43:35 Last update: September 25, 2008 23:43:54
@INC is a list of directories Perl uses to find modules to load. You can add directories to @INC by use lib... , or set the PERLLIB environment variable:
# using default @INC use Net::Socket::NonBl...
Created by Dr. Xi on December 12, 2007 20:30:01 Last update: December 12, 2007 20:32:23
This is a script to tail a log file through the web browser. It uses AJAX, apache web server, mod_python, UNIX utilities tail (requires the --lines switch) and wc . The log file may reside on the web server or any other host accessible from the web server through SSH. Although it's written in python, it should be easy to port to other languages such as Perl. Apache httpd.conf :
LoadModule python_module modules/mod_python.so ...Python script:
import time, os from os.path import basename ...