1. 程式人生 > >遞迴、os.walk、內建函式、lambda、hashlib模組、md5加密、python安裝第三方模組、操作mysql資料庫

遞迴、os.walk、內建函式、lambda、hashlib模組、md5加密、python安裝第三方模組、操作mysql資料庫

#遞迴就是函式自己調自己,一般遞迴都會有在什麼情況下結束遞迴,一業可以有結束條件
#遞迴最多死迴圈999次,遞迴不能設定次數
# count=0
# def abc():
# global count
# count+=1
# print(count)
# print('abc')
# abc()
# abc()


#示例:
# def add():
# all_product=read_product()
# print(all_product)
# pname=input('請輸入產品名稱').strip()
# pprice = input('請輸入產品價格').strip()
# pcount = input('請輸入產品數量').strip()
# if not pname or not pprice or not pcount:
# print('產品名稱,價格,數量不能為空')
# elif pname in all_product:
# print('產品名稱已經存在')
# elif not price(pprice):
# print('價格不合法')
# elif not product_count(pcount):
# print('數量不合法')
# else:
# all_product[pname]={"價格":float(pprice),"數量":int(pcount)}
# write_product(all_product)
# print('新增成功')
# return #新增成功就退出迴圈
# return add()#上面不成功時,就重新呼叫函式重新執行

import os
#把e盤下面所有的以.log結尾的檔案,判斷一下,最近的訪問時間超過1個月,就刪掉
# os.walk()
for cur_path,cur_dir,cur_files in os.walk(r'E:/百度網盤/python學習計劃'):
print('當前路徑',cur_path)
print('當前路徑下的資料夾',cur_dir)
print('當前路徑下的檔案', cur_files)
print('='*20)


def find_movie(path='E:',endswith='mp4'):