Discuss / Python / 新手打卡

新手打卡

Topic source

邹lh

#1 Created at ... [Delete] [Delete and Lock User]
class Chain():
    def __init__(self,path=''):
        self._path = path
    def __getattr__(self, path):
        if path=='users':
            return lambda users: Chain('%s/users/:%s'%(self._path,users))
        return Chain('%s/%s'%(self._path,path))
    def __str__(self):
        return self._path
    __repr__ = __str__


if __name__ == '__main__':
    c = Chain()
    print(c.sfs.sdfsdf.users('Micherl').dfs)

  • 1

Reply