获取主机名.用户.组.网络信息相关函数 首先是获取主机名的方式,Perl提供了Sys::Hostname模块,可以查询当前的主机名: use Sys::Hostname; print hostname, "\n"; Perl中提供了下面一大堆的内置函数用来获取用户.组.网络相关的信息.这些perl函数在C中也都有对应的函数. # 获取和设置用户和组 endgrent - be done using group file endpwent - be done using passwd f…
#coding=utf-8 import os command = 'ping www.baidu.com ' #可以直接在命令行中执行的命令 r = os.popen(command) #执行该命令 info = r.readlines() #读取命令行的输出到一个list for line in info: #按行遍历 line = line.strip('\r\n') print line ----------------------------------…
https://www.cnblogs.com/captain_jack/archive/2011/01/11/1933366.html zzz.py import sys from optparse import OptionParser filelist = ["/home/an/a","/home/an/b"] def main(filelist,tmpfile=None): for filename in filelist: with open(filena…
In [17]: now.strftime(%a),now.strftime(%w) Out[17]: ('Mon', '1') Directive Meaning %a Weekday name. %A Full weekday name. %b Abbreviated month name. %B Full month name. %c Appropriate date and time representation. %d Day of the month as a decimal num…