Displaying keyword search results 1 - 3
Created by Dr. Xi on June 06, 2009 18:31:44 Last update: June 25, 2012 12:37:35
You can use the system call from the os module to execute an external program:
>>> import os >>> os.system(the_command_line_st...However, the path to the executable contains a space character, the system call treats the strings after the first space as arguments, causing an error. Python doc recommends the use of the subprocess module: The subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using this function. For example, using wget to get the google home page:
>>> from subprocess import Popen, PIPE >>> (out...or
>>> import subprocess >>> subprocess.call(['cur...
Created by James on July 06, 2010 19:35:00 Last update: July 06, 2010 19:35:00
Java has built-in functions to get the basename and dirname for a given file path, but the function names are not so self-apparent.
import java.io.File; public class JavaFileD...Results:
C:\tmp>java JavaFileDirNameBaseName Dirname: .....
Created by Dr. Xi on September 29, 2008 23:21:38 Last update: January 16, 2010 23:36:05
Create a startup script for inetd Copy /etc/init.d/skeleton to /etc/init.d/inetd . Change the top section of the script to read:
PATH=/usr/sbin:/usr/bin:/sbin:/bin DESC="In...Now inetd can be stopped/started/restarted like this:
sudo /etc/init.d/inetd stop sudo /etc/init....Add links to rc*.d
$ sudo update-rc.d inetd defaults Adding sy...If you no longer need to start inetd at boot up:
$ sudo update-rc.d -f inetd remove update-r...This would remove the links from the start up sequence but leave /etc/init.d/inetd in place. Contents of /etc/init.d/skeleton :
#! /bin/sh ### BEGIN INIT INFO # Provide...