EG:
drwx------ 3 user group 0 Dec 2 12:09 Java_server_proxy
drwx------ 3 user group 0 Dec 1 12:42 agent
drwx------ 3 user group 0 Nov 26 09:21 download
drwx------ 3 user group 0 Nov 27 07:18 gae-server
drwx------ 3 user group 0 Nov 28 16:11 openssl
drwx------ 3 user group 0 Nov 26 08:09 python
-rw------- 1 user group 15672 Dec 2 12:00 Java_server_proxy.rar
-rw------- 1 user group 18650 Dec 2 12:04 Java_server_proxy.zip
#将空格规范后的文件列表
def parse_file_list(parsed_list,file_quantity):
all_file_name=""
all_file_create_data=""
all_file_size = ""
all_file_user=""
all_file_operator_limit=""
for i in range(0,file_quantity):
i_handle_line = parsed_list.split("\r\n")[i]
#handle a file
the_line = i_handle_line.split(" ")
file_name = the_line[8]
file_create_data = the_line[7]+" "+"created at "+the_line[6]+" "+the_line[5]
file_size = the_line[4]
file_user = the_line[3]+the_line[2]+the_line[1]
file_operator_limit = the_line[0]
all_file_name+=file_name+"\r\n"
all_file_create_data+=file_name+" "+file_create_data+"\r\n"
all_file_size +=file_size+"\r\n"
all_file_user +=file_user+"\r\n"
all_file_operator_limit+=file_operator_limit+"\r\n"
return all_file_name,all_file_create_data,all_file_size,all_file_user,all_file_operator_limit
#将得到的文件列表 decode("utf-8")后传入
def Get_File_Name(file_list):
#file number
file_quantity = len(file_list.split("\n"))-1
parsed_list = ""
for i in range(0,file_quantity):
#将多个空格转为一个
one_line = re.sub(r'\s+',' ',file_list.split("\n")[i])
parsed_list+=one_line+"\r\n"
print parsed_list
return parse_file_list(parsed_list,file_quantity)
drwx------ 3 user group 0 Dec 2 12:09 Java_server_proxy
drwx------ 3 user group 0 Dec 1 12:42 agent
drwx------ 3 user group 0 Nov 26 09:21 download
drwx------ 3 user group 0 Nov 27 07:18 gae-server
drwx------ 3 user group 0 Nov 28 16:11 openssl
drwx------ 3 user group 0 Nov 26 08:09 python
-rw------- 1 user group 15672 Dec 2 12:00 Java_server_proxy.rar
-rw------- 1 user group 18650 Dec 2 12:04 Java_server_proxy.zip
#将空格规范后的文件列表
def parse_file_list(parsed_list,file_quantity):
all_file_name=""
all_file_create_data=""
all_file_size = ""
all_file_user=""
all_file_operator_limit=""
for i in range(0,file_quantity):
i_handle_line = parsed_list.split("\r\n")[i]
#handle a file
the_line = i_handle_line.split(" ")
file_name = the_line[8]
file_create_data = the_line[7]+" "+"created at "+the_line[6]+" "+the_line[5]
file_size = the_line[4]
file_user = the_line[3]+the_line[2]+the_line[1]
file_operator_limit = the_line[0]
all_file_name+=file_name+"\r\n"
all_file_create_data+=file_name+" "+file_create_data+"\r\n"
all_file_size +=file_size+"\r\n"
all_file_user +=file_user+"\r\n"
all_file_operator_limit+=file_operator_limit+"\r\n"
return all_file_name,all_file_create_data,all_file_size,all_file_user,all_file_operator_limit
#将得到的文件列表 decode("utf-8")后传入
def Get_File_Name(file_list):
#file number
file_quantity = len(file_list.split("\n"))-1
parsed_list = ""
for i in range(0,file_quantity):
#将多个空格转为一个
one_line = re.sub(r'\s+',' ',file_list.split("\n")[i])
parsed_list+=one_line+"\r\n"
print parsed_list
return parse_file_list(parsed_list,file_quantity)
Comments
Post a Comment