In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains the "python3.6 how to output a folder to match all the file names", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "python3.6 how to output a folder to match all the file names" bar!
#-*-coding:utf-8-*-import osimport sysimport re# intercepts the file name def getFileList (path): for root,dirs,names in os.walk (path): pattern = re.compile (ringing XX') # based on the folder. Set the regular expression to the pattern object pattern1 = re.compile (ringing ZZ') for filename in names: match = pattern.search (filename) # to determine whether XX is included in the filename, and if so Then return true match2 = pattern1.search (filename) # to determine whether the filename contains ZZ, and if so, return true if match: # # code = len = filename.find ('XX') # find the location where filename begins with XX print (filename [len + 8]) # print Note that the string starts at 0: # # code = len = filename.find ('ZZ') print (filename [len: len + 8]) if _ _ name__ = =' _ _ main__': path = "C:\\ Users\\ SP000186\\ Desktop\ svn\ release\\ 11_dev\\ plsql" getFileList (path) Thank you for your reading The above is the content of "how python3.6 outputs all file names that match under a folder". After the study of this article, I believe you have a deeper understanding of how python3.6 outputs all file names that match under a folder, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.