摘要:
def load_file(self, filename): #读文件 data = {} if os.path.exists(filename) and os.path.getsize(filename) > 0: try: with open(filename, "rb") as r: tmp 阅读全文
摘要:
def log_info(self, filename): """ init logger """ log = logging.getLogger("Redis") log.setLevel(logging.WARNING) # 日志级别,这个级别之上的打印 fh = logging.handler 阅读全文
摘要:
import socket import commands def get_ip(): hostname = socket.gethostname() #print(hostname) hostip = "127.0.0.1" try: hostip = socket.gethostbyname(h 阅读全文
摘要:
#!/usr/bin/env python # encoding: utf-8 # 查看主机名 import socket def gethostname(): hostname = socket.gethostname() return hostname ret = gethostname() p 阅读全文