• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python posixpath.basename函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中posixpath.basename函数的典型用法代码示例。如果您正苦于以下问题:Python basename函数的具体用法?Python basename怎么用?Python basename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了basename函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: process_presence_update

    def process_presence_update(msg):
        message_type = msg.delivery_info["routing_key"]
        payload = json.loads(msg.body)

        namespace = payload["namespace"]
        if not namespace.startswith("/robin/"):
            return

        user_id36 = posixpath.basename(namespace)
        room_namespace = posixpath.dirname(namespace)
        room_id = posixpath.basename(room_namespace)

        account = Account._byID36(user_id36, data=True, stale=True)
        try:
            room = RobinRoom._byID(room_id)
        except tdb_cassandra.NotFoundException:
            return

        if not room.is_participant(account):
            return

        presence_type = "join" if message_type == "websocket.connect" else "part"

        websockets.send_broadcast(
            namespace=room_namespace,
            type=presence_type,
            payload={
                "user": account.name,
            },
        )

        if presence_type == "join":
            ParticipantPresenceByRoom.mark_joined(room, account)
        else:
            ParticipantPresenceByRoom.mark_exited(room, account)
开发者ID:13steinj,项目名称:reddit-plugin-robin,代码行数:35,代码来源:presence.py


示例2: RemoteHostCopy

  def RemoteHostCopy(self, file_path, remote_path='', copy_to=True):
    """Copies a file to or from the VM.

    Args:
      file_path: Local path to file.
      remote_path: Optional path of where to copy file on remote host.
      copy_to: True to copy to vm, False to copy from vm.

    Raises:
      RemoteCommandError: If there was a problem copying the file.
    """
    if copy_to:
      file_name = posixpath.basename(file_path)
      src_spec, dest_spec = file_path, '%s:%s' % (self.name, file_name)
    else:
      remote_path, _ = self.RemoteCommand('readlink -f %s' % remote_path)
      remote_path = remote_path.strip()
      src_spec, dest_spec = '%s:%s' % (self.name, remote_path), file_path
    cmd = [FLAGS.kubectl, '--kubeconfig=%s' % FLAGS.kubeconfig,
           'cp', src_spec, dest_spec]
    stdout, stderr, retcode = vm_util.IssueCommand(cmd)
    if retcode:
      error_text = ('Got non-zero return code (%s) executing %s\n'
                    'STDOUT: %sSTDERR: %s' %
                    (retcode, ' '.join(cmd), stdout, stderr))
      raise errors.VirtualMachine.RemoteCommandError(error_text)
    if copy_to:
      file_name = posixpath.basename(file_path)
      remote_path = remote_path or file_name
      self.RemoteCommand('mv %s %s; chmod 777 %s' %
                         (file_name, remote_path, remote_path))
开发者ID:9723,项目名称:PerfKitBenchmarker,代码行数:31,代码来源:kubernetes_virtual_machine.py


示例3: findNodeIndex

    def findNodeIndex(self, filename, nodename):
        nexus_widget = self.neXusWidget()
        file_model = nexus_widget.model()

        for node in file_model.rootItem.children:
            if node.file.filename == filename:
                file_node = node
                break
        else:
            raise Exception("Could not find file %s" % filename)

        index = file_model.index(file_node.row, 0, Qt.QModelIndex())

        node_parts = nodename.split(posixpath.sep)
        while node_parts:
            name = posixpath.basename(node_parts.pop(0))
            for child in node.children:
                child_name = posixpath.basename(child.name)
                if child_name == name:
                    node = child
                    index = file_model.index(node.row, 0, index)
                    break
            else:
                raise Exception("Could not find node %s in %s" % (name, filename))
        return index
开发者ID:cpascual,项目名称:taurus,代码行数:25,代码来源:taurusnexuswidget.py


示例4: run

    def run(self):
        """Run substitutions on files."""
        super(checkbox_install_data, self).run()

        examplesfiles = [o for o in self.outfiles if "examples" in o]
        if not examplesfiles:
            return

        # Create etc directory
        if self.install_dir == "/usr":
            basedir = posixpath.sep
        else:
            basedir = self.install_dir
        etcdir = posixpath.join(basedir, "etc", "checkbox.d")
        self.mkpath(etcdir)

        # Create configs symbolic link
        dstdir = posixpath.dirname(examplesfiles[0]).replace("examples",
            "configs")
        if not os.path.exists(dstdir):
            os.symlink(etcdir, dstdir)

        # Substitute version in examplesfiles and etcfiles
        version = changelog_version()
        for examplesfile in examplesfiles:
            etcfile = posixpath.join(etcdir,
                posixpath.basename(examplesfile))
            infile = posixpath.join("examples",
                posixpath.basename(examplesfile))
            for outfile in examplesfile, etcfile:
                substitute_variables(infile, outfile, {
                    "version = dev": "version = %s" % version})
开发者ID:jds2001,项目名称:ocp-checkbox,代码行数:32,代码来源:setup.py


示例5: cmd_list

 def cmd_list(self):
     if self.args.podcast_id is None:
         print 'Podcast feeds available:'
         print
         for pid in self.config.podcast:
             print '    %s - %s' % (pid, self.config.podcast[pid])
         print
         return os.EX_OK
     else:
         print 'Fetched files available for "%s" (sorted by name):' \
               % self.args.podcast_id
         print
         count = 1
         for filepath in self.podcast.list_fetched_chapters():
             print '    %i: %s' % (count, os.path.basename(filepath))
             count += 1
         if count == 1:
             print '    **** No fetched files.'
         print
         print 'Remote files available for "%s" (reverse sorted by date):' \
               % self.args.podcast_id
         print
         count = 1
         for url in self.podcast.list_chapters():
             if isinstance(url, basestring):
                 print '    %i: %s' % (count, posixpath.basename(url))
             else:
                 print '    %i: %s (%s)' % (count,
                                            posixpath.basename(url[0]),
                                            url[1])
             count += 1
         if count == 1:
             print '    **** No remote files. Try running this script ' \
                   'with `--sync\''
         print
开发者ID:rafaelmartins,项目名称:marrie,代码行数:35,代码来源:marrie.py


示例6: __call__

    def __call__(self, oeb, opts):
        self.log = oeb.logger
        self.opts = opts
        self.oeb = oeb

        self.seen_filenames = set([])
        self.rename_map = {}

        for item in list(oeb.manifest.items):
            fname = posixpath.basename(item.href)
            if fname in self.seen_filenames:
                suffix = self.unique_suffix(fname)
                data = item.data
                base, ext = posixpath.splitext(item.href)
                nhref = base + suffix + ext
                nhref = oeb.manifest.generate(href=nhref)[1]
                spine_pos = item.spine_position
                oeb.manifest.remove(item)
                nitem = oeb.manifest.add(item.id, nhref, item.media_type, data=data,
                        fallback=item.fallback)
                self.seen_filenames.add(posixpath.basename(nhref))
                self.rename_map[item.href] = nhref
                if spine_pos is not None:
                    oeb.spine.insert(spine_pos, nitem, item.linear)
            else:
                self.seen_filenames.add(fname)

        if self.rename_map:
            self.log('Found non-unique filenames, renaming to support broken'
                    ' EPUB readers like FBReader, Aldiko and Stanza...')
            from pprint import pformat
            self.log.debug(pformat(self.rename_map))

            renamer = RenameFiles(self.rename_map)
            renamer(oeb, opts)
开发者ID:AEliu,项目名称:calibre,代码行数:35,代码来源:filenames.py


示例7: data

 def data(self, index, role):
     if role != qt.Qt.DisplayRole:
         return MyQVariant()
     item = self.getProxyFromIndex(index)
     column = index.column()
     if column == 0:
         if isinstance(item, H5FileProxy):
             return MyQVariant(os.path.basename(item.file.filename))
         else:
             return MyQVariant(posixpath.basename(item.name))
     if column == 1:
         showtitle = True
         if showtitle:
             if hasattr(item, 'type'):
                 if item.type in ["Entry", "NXentry"]:
                     children = item.children
                     names = [posixpath.basename(o.name) for o in children]
                     if "title" in names:
                         idx = names.index("title")
                         if len(children[idx].getNode().shape):
                             #stored as an array of strings!!!
                             #return just the first item
                             return MyQVariant("%s" % children[idx].getNode().value[0])
                         else:
                             #stored as a string
                             return MyQVariant("%s" % children[idx].getNode().value)
         return MyQVariant(item.type)
     if column == 2:
         return MyQVariant(item.shape)
     if column == 3:
         return MyQVariant(item.dtype)
     return MyQVariant()
开发者ID:marcus-oscarsson,项目名称:pymca,代码行数:32,代码来源:HDF5Widget.py


示例8: test_basename

    def test_basename(self):
        self.assertEqual(posixpath.basename("/foo/bar"), "bar")
        self.assertEqual(posixpath.basename("/"), "")
        self.assertEqual(posixpath.basename("foo"), "foo")
        self.assertEqual(posixpath.basename("////foo"), "foo")
        self.assertEqual(posixpath.basename("//foo//bar"), "bar")

        self.assertRaises(TypeError, posixpath.basename)
开发者ID:CaoYouXin,项目名称:myfirstapicloudapp,代码行数:8,代码来源:test_posixpath.py


示例9: parseAll

def parseAll(path):
    for root, dirs, files in os.walk(path):
        print("processing: " + basename(root.replace("\\", "/")))
        if len(files) and basename(root.replace("\\", "/")) != "ARM_SAMPLE":
            for file in files:
                filename, file_extension = posixpath.splitext(file)
                if file_extension == ".svd":
                    parseFile(basename(root.replace("\\", "/")), filename)
开发者ID:porkybrain,项目名称:Kvasir,代码行数:8,代码来源:MakeChipFiles.py


示例10: makeHDF5

    def makeHDF5(self, rewrite=False):
        """
        Create the HDF5 structure if needed ...
        """
        print("Initialization of HDF5 file")
        if os.path.exists(self.hdf5) and rewrite:
            os.unlink(self.hdf5)

        spath = self.hdf5path.split("/")
        assert len(spath) > 2
        nxs = Nexus(self.hdf5, mode="w")
        entry = nxs.new_entry(entry=spath[0], program_name="pyFAI", title="diffmap")
        grp = entry
        for subgrp in spath[1:-2]:
            grp = nxs.new_class(grp, name=subgrp, class_type="NXcollection")

        processgrp = nxs.new_class(grp, "pyFAI", class_type="NXprocess")
        processgrp["program"] = numpy.array([numpy.str_(i) for i in sys.argv])
        processgrp["version"] = numpy.str_(PyFAI_VERSION)
        processgrp["date"] = numpy.str_(get_isotime())
        if self.mask:
            processgrp["maskfile"] = numpy.str_(self.mask)
        if self.flat:
            processgrp["flatfiles"] = numpy.array([numpy.str_(i) for i in self.flat])
        if self.dark:
            processgrp["darkfiles"] = numpy.array([numpy.str_(i) for i in self.dark])
        processgrp["inputfiles"] = numpy.array([numpy.str_(i) for i in self.inputfiles])
        processgrp["PONIfile"] = numpy.str_(self.poni)

        processgrp["dim0"] = self.npt_slow
        processgrp["dim0"].attrs["axis"] = "Rotation"
        processgrp["dim1"] = self.npt_fast
        processgrp["dim1"].attrs["axis"] = "Translation"
        processgrp["dim2"] = self.npt_rad
        processgrp["dim2"].attrs["axis"] = "Diffraction"
        for k, v in self.ai.getPyFAI().items():
            if "__len__" in dir(v):
                processgrp[k] = numpy.str_(v)
            elif v:
                processgrp[k] = v

        self.group = nxs.new_class(grp, name=spath[-2], class_type="NXdata")

        if posixpath.basename(self.hdf5path) in self.group:
            self.dataset = self.group[posixpath.basename(self.hdf5path)]
        else:
            self.dataset = self.group.create_dataset(
                name=posixpath.basename(self.hdf5path),
                shape=(self.npt_slow, self.npt_fast, self.npt_rad),
                dtype="float32",
                chunks=(1, self.npt_fast, self.npt_rad),
                maxshape=(None, None, self.npt_rad))
            self.dataset.attrs["signal"] = "1"
            self.dataset.attrs["interpretation"] = "spectrum"
            self.dataset.attrs["axes"] = str(self.unit).split("_")[0]
            self.dataset.attrs["creator"] = "pyFAI"
            self.dataset.attrs["long_name"] = "Diffraction imaging experiment"
        self.nxs = nxs
开发者ID:t20100,项目名称:pyFAI,代码行数:58,代码来源:diffmap.py


示例11: get_trace

def get_trace(filename, fileno):
    data = get_data(filename)
    group_label = ""
    if fileno % 2 == 0:
        group_label = posixpath.basename(filename).split(".")[0] + ":after stimulation"
    else:
        group_label = posixpath.basename(filename).split(".")[0] + ":before stimulation"
    trace = go.Histogram(x=data, opacity=0.75, name=group_label)
    return trace
开发者ID:tai271828,项目名称:alice-the-cutie,代码行数:9,代码来源:hist2.py


示例12: Search

def Search(term):
	resultText = ""
	with ix.searcher() as searcher:
		query = QueryParser("content", ix.schema).parse(term)
		corrector = searcher.corrector("content")
		# for mistyped_word in mistyped_words:
		Suggestions = corrector.suggest(term, limit=3)
		if(Suggestions):
			resultText += "<li><h2 class='suggestion_header'>Suggestions based on content</h2></li>"
			for Suggestion in Suggestions:
				resultText += "<li><h3><a href='#' class='suggestions'> " + Suggestion + "</a></h3></li>"
		resultText += "<li>"
		corrected = searcher.correct_query(query, term)
		if corrected.query != query:
			resultText += "<li><h3 class='did_you_mean'>Did You Mean: </h3><p><a class='suggestions'>" + corrected.string + "</a></p>"

		results = searcher.search(query, terms=True,limit=None)
		
		# results.fragmenter = highlight.PinpointFragmenter(autotrim=True)
		# results.formatter = highlight.UppercaseFormatter(between = "...")
		terms=term.split(" ")
		# resultText += " estimated_min_length " + str(results.estimated_min_length()) 
		if results.estimated_min_length() < 11:
			urls = open("uniqueUrltest.txt",'r')
			i = 0
			for url in urls:
				if i < 6:
					if any(word in url for word in terms):
						parse_object = urlparse.urlparse(url)
						if "." not in url and "/" == url[-1]:
							url = url[0:-2]
							title_head = basename(url).decode("utf-8", 'ignore')
						else:
							title_head = basename(parse_object.path).split(".")[0].decode("utf-8", 'ignore')
						
						resultText += "<h3><a href='"+url+"'>" + title_head + "</a></h3><p class='green'>" + url+ "</p>"
						i += 1
			urls.close()
		for result in results:
			# i=0
			# if ".pdf" in str(result["path"]) and i<3:
			# 	resultText += "<h1>" + "<a href='" + result["path"] + "'>" + result["path"] + "</a><br/></h1>" + result["path"] + "<br/><br/>" + result.highlights("content") + "<br/>"
			# 	i += 1
			# 	del results[result]
			if "title" in result:
				if "error" in result["title"].lower():
					resultText += "<h3>" + "<a href='" + result["path"] + "'>" + result["path"] + "</a></h3><p class='url'>" + result["path"] + "</p><p>" + result.highlights("content") + "</p>"
				else:
					if(result["title"] == "" ) or result["title"].isspace():
						resultText += "<h3 class='title_head'>" + "<a href='" + result["path"] + "'>" + "No Title Present" + "</a></h3><p class='url'>" + result["path"] + "</p><p>"  + result.highlights("content") + "</p>"
					else:
						resultText += "<h3 class='title_head'>" + "<a href='" + result["path"] + "'>" + result["title"] + "</a></h3><p class='url'>" + result["path"] + "</p><p>"  + result.highlights("content") + "</p>"
	if(resultText == "<li>"):
		resultText = ""
	else:	
		resultText += "</li>"
	return resultText
开发者ID:suraj1074,项目名称:search-engine,代码行数:57,代码来源:search.py


示例13: plot_sensor_data_from_file

    def plot_sensor_data_from_file(self, file_path):
        if not self.to_save and not self.to_show:
            return

        data = np.genfromtxt(file_path, delimiter=',', skip_header=1, names=['timestamp', 'x', 'y', 'z'])

        file_name = basename(file_path)
        file_name = file_name[:file_name.find(".")]

        View.plot_sensor_data(basename(file_name), data['timestamp'], data['x'], data['y'], data['z'])
开发者ID:bmswgnp,项目名称:Deep-Spying,代码行数:10,代码来源:View.py


示例14: hdf5Slot

 def hdf5Slot(self, ddict):
     if ddict['event'] == 'itemClicked':
         if ddict['mouse'] == "right":
             return self.itemRightClickedSlot(ddict)
     if ddict['event'] == "itemDoubleClicked":
         if ddict['type'] in ['Dataset']:
             if ddict['dtype'].startswith('|S'):
                 print("string")
             else:
                 root = ddict['name'].split('/')
                 root = "/" + root[1]
                 if len(ddict['name']) == len(root):
                     cnt = ddict['name']
                 else:
                     cnt  = ddict['name'][len(root):]
                 if cnt not in self._cntList:
                     self._cntList.append(cnt)
                     basename = posixpath.basename(cnt)
                     if basename not in self._aliasList:
                         self._aliasList.append(basename)
                     else:
                         self._aliasList.append(cnt)
                     self.cntTable.build(self._cntList, self._aliasList)
         elif ddict['type'] in ['NXentry', 'Entry']:
             if self._lastAction is None:
                 return
             action, selectionType = self._lastAction.split()
             if action == 'REMOVE':
                 action = 'ADD'
             ddict['action'] = "%s %s" % (action, selectionType)
             self.buttonsSlot(ddict)
         else:
             if self.data is not None:
                 name = ddict['name']
                 filename = ddict['file']
                 fileIndex = self.data.sourceName.index(filename)
                 phynxFile  = self.data._sourceObjectList[fileIndex]
                 dataset = phynxFile[name]
                 if isinstance(dataset, h5py.Dataset):
                     root = ddict['name'].split('/')
                     root = "/" + root[1]
                     cnt  = ddict['name'].split(root)[-1]
                     if cnt not in self._cntList:
                         if DEBUG:
                             print("USING SECOND WAY")
                         self._cntList.append(cnt)
                         basename = posixpath.basename(cnt)
                         if basename not in self._aliasList:
                             self._aliasList.append(basename)
                         else:
                             self._aliasList.append(cnt)
                         self.cntTable.build(self._cntList, self._aliasList)
                     return
             if DEBUG:
                 print("Unhandled item type: %s" % ddict['dtype'])
开发者ID:dnaudet,项目名称:pymca,代码行数:55,代码来源:QNexusWidget.py


示例15: compare_links

    def compare_links(self):
        ret = False
        if isinstance(self.devpi_body, Exception):
            tw.line("%s: devpi request failed: %s" %
                    (self.name, self.devpi_body), red=True)
            ret = True
        if isinstance(self.pypi_body, Exception):
            tw.line("%s: pypi request failed: %s" %
                    (self.name, self.pypi_body), red=True)
            ret = True
        if ret:
            return

        pypi_links = BeautifulSoup(self.pypi_body).findAll("a")
        devpi_links = BeautifulSoup(self.devpi_body).findAll("a")
        misses = []
        count = 0
        pypi_basenames = set()
        for link in pypi_links:
            href = link.get("href")
            if href.startswith("../../packages"):
                count += 1
                # stored at pypi, should appear directly with devpi
                package_prefix = href[6:]
                pypi_basenames.add(posixpath.basename(href))
                #print package_prefix
                for link2 in devpi_links:
                    #print "   ", link2.get("href")
                    if link2.get("href").endswith(package_prefix):
                        break
                else:
                    misses.append((href))
        b = logbase.join("res", self.name).ensure(dir=1)
        misses_path = b.join("devpi_misses")
        if misses:
            tw.line("%s: devpi misses %d out of %d links" %
                    (self.name, len(misses), count), red=True)
            misses_path.write("\n".join(misses))
        else:
            if misses_path.check():
                misses_path.remove()
            extralinks = []
            for link2 in devpi_links:
                devpi_basename = posixpath.basename(link2.get("href"))
                if devpi_basename not in pypi_basenames:
                    extralinks.append(devpi_basename)
            if extralinks:
                extra = ", externally scraped: %s" % (extralinks)
            else:
                extra = ""

            tw.line("%s: devpi has %d pypi internal links%s" %
                    (self.name, count, extra), green=True)
        b.join("pypi_body").write(self.pypi_body)
        b.join("devpi_body").write(self.devpi_body)
开发者ID:kenatbasis,项目名称:devpi,代码行数:55,代码来源:compare_pypi_devpi.py


示例16: download_path

def download_path(request, filename):
    parts = posixpath.normpath(filename).split("/")
    if len(parts) < 3:
        return HttpResponseBadRequest()
    
    requested_file = parts[-1]

    try: version_num = str(int(parts[-2]))
    except ValueError: version_num = None
    
    if version_num is None:
        base_path = "/".join(parts[:-2])
        type_id = parts[-2]
        versions = get_versions('/' + base_path)
        if versions is None:
            return HttpResponseNotFound()
        version_num = str(max(map(int, versions)))
    else:
        base_path = "/".join(parts[:-3])
        type_id = parts[-3]

    try: 
        file_metadata = get_file_metadata("/%s/%s" % (base_path, version_num))
    except NotFoundError:
        return HttpResponseNotFound()

    if requested_file == posixpath.basename(base_path):
        is_mesh = True
        hash = file_metadata['types'][type_id]['hash']
    else:
        is_mesh = False
        subfile_map = {}
        for subfile in file_metadata['types'][type_id]['subfiles']:
            (subfile_base, vers) = posixpath.split(subfile)
            subfile_basename = posixpath.basename(subfile_base)
            subfile_map[subfile_basename] = subfile

        if requested_file not in subfile_map:
            return HttpResponseNotFound()

        subfile_metadata = get_file_metadata(subfile_map[requested_file])
        hash = subfile_metadata['hash']

    try:
        rec = get_hash(hash)
    except NotFoundError:
        return HttpResponseNotFound()

    data = rec['data']
    mime = rec['mimetype']

    response = HttpResponse(data, mimetype=mime)
    response['Content-Length'] = str(len(data))
    response['Access-Control-Allow-Origin'] = '*'
    return response
开发者ID:hnkien,项目名称:sirikata-cdn,代码行数:55,代码来源:views.py


示例17: insert

    def insert(self, path, entry):
        if path == '/':
            assert entry.ftype == DIR
            self.index = entry
        else:
            assert ppath.basename(path) == entry.name

            parent = self.lookup(ppath.dirname(path))
            assert parent.ftype == DIR

            parent.items[ppath.basename(path)] = entry
开发者ID:esironal,项目名称:autofs,代码行数:11,代码来源:fsindex.py


示例18: find_in_zip

def find_in_zip(filepath, zip):
    if filepath in zip.namelist():
        return zip.read(filepath)
    basename = posixpath.basename(filepath)
    matching = []
    for zipname in zip.namelist():
        if posixpath.basename(zipname) == basename:
            matching.append(zipname)
    if len(matching) == 1:
        return zip.read(matching[0])
    else:
        return None
开发者ID:hnkien,项目名称:sirikata-cdn,代码行数:12,代码来源:import_upload.py


示例19: test_basename

    def test_basename(self):
        self.assertEqual(posixpath.basename("/foo/bar"), "bar")
        self.assertEqual(posixpath.basename("/"), "")
        self.assertEqual(posixpath.basename("foo"), "foo")
        self.assertEqual(posixpath.basename("////foo"), "foo")
        self.assertEqual(posixpath.basename("//foo//bar"), "bar")

        self.assertEqual(posixpath.basename(b"/foo/bar"), b"bar")
        self.assertEqual(posixpath.basename(b"/"), b"")
        self.assertEqual(posixpath.basename(b"foo"), b"foo")
        self.assertEqual(posixpath.basename(b"////foo"), b"foo")
        self.assertEqual(posixpath.basename(b"//foo//bar"), b"bar")
开发者ID:chidea,项目名称:GoPythonDLLWrapper,代码行数:12,代码来源:test_posixpath.py


示例20: _walk

 def _walk(self, path):
     dirs, nondirs = [], []
     for e in self.ls(path):
         if self.isdir(e):
             dirs.append(posixpath.basename(re.sub("/$", "", e)))
         else:
             nondirs.append(posixpath.basename(e))
     yield path, dirs, nondirs
     for d in dirs:
         path2 = posixpath.join(path, d)
         #yield from self.walk(path2)
         for t in self.walk(path2):
             yield t
开发者ID:mazhe,项目名称:cimtp,代码行数:13,代码来源:main.py



注:本文中的posixpath.basename函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python posixpath.commonprefix函数代码示例发布时间:2022-05-25
下一篇:
Python posixpath.abspath函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap