Home

Apr. 6th, 2026

  • 2:06 PM
maxsol3
Friends Only

Жалобы и предложения можно оставлять в этом посте.

Hair

  • Nov. 23rd, 2009 at 1:34 PM
maxsol3


Компьютерная модель роста моей бороды.

Tags:

Прогулка по HD

  • Nov. 22nd, 2009 at 3:28 PM
maxsol3
import re, os

path = u"/Users/username/Documents"

class diskwalk(object):
    """Интерфейс доступа к коллекциям, получаемым при обходе каталога"""
    def __init__(self, path):
        self.path = path

    def enumeratePaths(self):
        path_collection = []
        for dirpath, dirnames, filenames in os.walk(self.path):
            for file in filenames:
                fullpath = os.path.join(dirpath, file)
                path_collection.append(fullpath)
        
        return path_collection
    
    def enumerateFiles(self):
        file_collection = []
        for dirpath, dirnames, filenames in os.walk(self.path):
            for file in filenames:
                file_collection.append(file)

        return file_collection

    
    def enumerateDir(self):
        dir_collection = []
        for dirpath, dirnames, filenames in os.walk(self.path):
            for dir in dirnames:
                dir_collection.append(dir)

        return dir_collection


testdir = diskwalk(path)

print testdir.enumerateDir()

Tags:

Profile

maxsol3
[info]maxsol
Алексей Соловьев
Website

Advertisement

Latest Month

November 2009
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930     

Syndicate

RSS Atom
Powered by LiveJournal.com
Designed by Lilia Ahner