{"id":651,"date":"2021-04-30T15:35:53","date_gmt":"2021-04-30T07:35:53","guid":{"rendered":"https:\/\/huiyu1688.top\/?p=651"},"modified":"2021-04-30T15:35:55","modified_gmt":"2021-04-30T07:35:55","slug":"%e4%bd%bf%e7%94%a8python%e5%ae%9e%e7%8e%b0%e8%bf%ad%e4%bb%a3%e9%81%8d%e5%8e%86%e6%96%87%e4%bb%b6%e5%a4%b9%e4%b8%8b%e7%9a%84%e6%96%87%e4%bb%b6","status":"publish","type":"post","link":"https:\/\/hy68.top\/index.php\/2021\/04\/30\/651\/","title":{"rendered":"\u4f7f\u7528python\u5b9e\u73b0\u8fed\u4ee3\u904d\u5386\u6587\u4ef6\u5939\u4e0b\u7684\u6587\u4ef6"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>import os\r\n\r\n#\u6587\u672c\u8bb0\u5f55\u8868\u683c\r\nmyTxtRecordTableList=&#91;]        \r\n\r\n#\u516c\u53f8\u540d\u63d0\u53d6\r\ndef getCompanyName(str_fileName):\r\n    return \"comp\"\r\n\r\n#\u65e5\u671f\u63d0\u53d6\r\n#\u9879\u76ee\u6587\u4ef6\u540d\u63d0\u53d6\r\n#\u5bbd\u9ad8\u6570\u91cf\u63d0\u53d6\r\n#\u5355\u4ef7\u63d0\u53d6\r\n#\u5176\u4ed6\u6536\u8d39\u63d0\u53d6\r\n\r\nfileLoad=input(\"\u8bf7\u8f93\u5165\u8def\u5f84\uff1a_\")\r\nfilenamesList=&#91;]\r\n\r\nfor folderName, subfolders, filenames in os.walk(fileLoad):\r\n    #print('The current folder is ' + folderName)\r\n\r\n    '''for subfolder in subfolders:\r\n        #\u76ee\u5f55\r\n        print('SUBFOLDER OF ' + folderName + ': ' + subfolder)\r\n        '''\r\n    for filename in filenames:\r\n        #\u5168\u8def\u5f84\u6587\u4ef6\u540d\r\n        print('FILE INSIDE ' + folderName + ': '+ filename)\r\n        print(len(filename))\r\n        myTxtRecordTableList.append(&#91;getCompanyName(filename),'01-09',filename,1.00,2.00,12,14.00,3.5])\r\n\r\n\r\n\r\nfor i in range(len(myTxtRecordTableList)):\r\n    print(myTxtRecordTableList&#91;i]&#91;0]+'\\t'+myTxtRecordTableList&#91;i]&#91;1]+\r\n          '\\t'+myTxtRecordTableList&#91;i]&#91;2]+'\\t'+str(myTxtRecordTableList&#91;i]&#91;3])+'\\t'+str(myTxtRecordTableList&#91;i]&#91;4])+'\\t'+str(myTxtRecordTableList&#91;i]&#91;5])+'\\t'+str(myTxtRecordTableList&#91;i]&#91;6]))\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":357,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,6],"tags":[28],"_links":{"self":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts\/651"}],"collection":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/comments?post=651"}],"version-history":[{"count":1,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts\/651\/revisions"}],"predecessor-version":[{"id":652,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts\/651\/revisions\/652"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/media\/357"}],"wp:attachment":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/media?parent=651"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/categories?post=651"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/tags?post=651"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}