久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <tfoot id='TrJEz'></tfoot>

    <small id='TrJEz'></small><noframes id='TrJEz'>

    <i id='TrJEz'><tr id='TrJEz'><dt id='TrJEz'><q id='TrJEz'><span id='TrJEz'><b id='TrJEz'><form id='TrJEz'><ins id='TrJEz'></ins><ul id='TrJEz'></ul><sub id='TrJEz'></sub></form><legend id='TrJEz'></legend><bdo id='TrJEz'><pre id='TrJEz'><center id='TrJEz'></center></pre></bdo></b><th id='TrJEz'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='TrJEz'><tfoot id='TrJEz'></tfoot><dl id='TrJEz'><fieldset id='TrJEz'></fieldset></dl></div>

    <legend id='TrJEz'><style id='TrJEz'><dir id='TrJEz'><q id='TrJEz'></q></dir></style></legend>

        • <bdo id='TrJEz'></bdo><ul id='TrJEz'></ul>

        如何將對話框窗口中的選定文件添加到字典中?

        how to add the selected files from dialog window to a dictionary?(如何將對話框窗口中的選定文件添加到字典中?)
        1. <tfoot id='wNgne'></tfoot>

            <small id='wNgne'></small><noframes id='wNgne'>

              <bdo id='wNgne'></bdo><ul id='wNgne'></ul>
            • <i id='wNgne'><tr id='wNgne'><dt id='wNgne'><q id='wNgne'><span id='wNgne'><b id='wNgne'><form id='wNgne'><ins id='wNgne'></ins><ul id='wNgne'></ul><sub id='wNgne'></sub></form><legend id='wNgne'></legend><bdo id='wNgne'><pre id='wNgne'><center id='wNgne'></center></pre></bdo></b><th id='wNgne'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='wNgne'><tfoot id='wNgne'></tfoot><dl id='wNgne'><fieldset id='wNgne'></fieldset></dl></div>

                  <tbody id='wNgne'></tbody>
                • <legend id='wNgne'><style id='wNgne'><dir id='wNgne'><q id='wNgne'></q></dir></style></legend>
                  本文介紹了如何將對話框窗口中的選定文件添加到字典中?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我希望它能夠打開一個對話窗口并選擇我的文件,

                  I wish it's able to open a dialog window and select my files,

                  a.txt
                  b.txt
                  

                  然后將它們添加到我的字典中

                  then add them in my dictionary

                  myDict = { "a.txt" : 0,
                             "b.txt" : 1}
                  

                  我在網站上搜索過

                  import Tkinter,tkFileDialog
                  root = Tkinter.Tk()
                  filez = tkFileDialog.askopenfilenames(parent=root,multiple='multiple',title='Choose a file')
                  

                  這些代碼用于打開對話窗口并選擇我的文件.但問題是如何將選中的文件添加到字典中?

                  these codes work for opening a dialog window and selecting my files. But the question is how to add the selected files to the dictionary?

                  有了斯蒂芬的回答,問題就解決了

                  With Stephan's answer, the problem is solved

                  myDict = {}
                  for filename in filez:
                      myDict[filename] = len(myDict)
                      print "myDict: " + str(myDict)
                  

                  現在 myDict 是

                  Now the myDict is

                  myDict = {'C:/a.txt': 0}
                  myDict = {'C:/a.txt': 0, 'C:/b.txt': 1}
                  

                  網上搜索后,添加os.path.split

                  After searching online, just add os.path.split

                  myDict = {}
                  for filename in filez:
                      head, tail = os.path.split(str(filename))
                      myDict[tail] = len(myDict)
                  

                  現在一切正常

                  myDict = {'a.txt': 0, 'b.txt': 1}
                  

                  我得到了沒有路徑的 myDict,問題解決了!謝謝!

                  I got the myDict without path, problem solved! Thanks!

                  推薦答案

                  myDict = {}
                  myDict[filenameFromDialog] = len(myDict)
                  

                  這是添加到字典的語法.

                  That is the syntax for adding to a dictionary.

                  如果您有一組文件要添加到字典中,您可以遍歷列表并一次添加一個:

                  If you have an array of files you want to add to the dictionary, you could loop over the list and add them one at a time:

                  myDict = {}
                  for filename in filez:
                      myDict[filename] = len(myDict)
                  

                  這篇關于如何將對話框窗口中的選定文件添加到字典中?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)

                • <i id='mN0IA'><tr id='mN0IA'><dt id='mN0IA'><q id='mN0IA'><span id='mN0IA'><b id='mN0IA'><form id='mN0IA'><ins id='mN0IA'></ins><ul id='mN0IA'></ul><sub id='mN0IA'></sub></form><legend id='mN0IA'></legend><bdo id='mN0IA'><pre id='mN0IA'><center id='mN0IA'></center></pre></bdo></b><th id='mN0IA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='mN0IA'><tfoot id='mN0IA'></tfoot><dl id='mN0IA'><fieldset id='mN0IA'></fieldset></dl></div>

                    • <tfoot id='mN0IA'></tfoot>

                      1. <legend id='mN0IA'><style id='mN0IA'><dir id='mN0IA'><q id='mN0IA'></q></dir></style></legend>
                          <bdo id='mN0IA'></bdo><ul id='mN0IA'></ul>
                              <tbody id='mN0IA'></tbody>

                            <small id='mN0IA'></small><noframes id='mN0IA'>

                            主站蜘蛛池模板: 视频一区二区在线观看 | 红色av社区 | 中文字幕成人av | 免费看黄色国产 | 午夜精品一区二区三区在线视 | 精品国产一区二区三区久久久久久 | 欧美视频一区二区三区 | 91成人在线视频 | av一区二区三区在线观看 | 亚洲第一区国产精品 | 午夜视频在线观看视频 | 国内精品视频在线观看 | 999精品网 | 久久精品视频网站 | 国产成人精品久久二区二区 | h片免费在线观看 | 欧美午夜一区 | 黑人巨大精品欧美一区二区免费 | 亚洲精品国产电影 | 台湾佬成人网 | 国产精品久久a | 99视频在线免费观看 | 亚洲系列第一页 | 婷婷去俺也去 | 久久香蕉网 | 亚洲日日 | 国产xxx在线观看 | 久久国内精品 | 免费观看色 | 中文字幕一区二区三区不卡在线 | 成人免费日韩 | 久久精品一区二区三区四区 | 久久国产成人精品国产成人亚洲 | 成人精品一区 | 天堂视频一区 | 亚洲自拍偷拍av | 日韩国产精品一区二区三区 | 日韩欧美精品一区 | 久久久久久免费毛片精品 | 在线一区二区三区 | 断背山在线观看 |