After registering deep learning on Cousera, you can download the after-class exercise.
1. After entering the programming environment, click File-open in the upper left corner to enter the file management mode
2. Click on the Red Circle folder to enter the root directory
3. In the top right corner of the root directory, new one IPYNB
4. Open the new IPYNB, enter and do the following, you can compress the files in the root directory into a zip format, download the zip file to get all the programming content
Import Zipfileimport osfor i in range (1,5): startdir = "week%d"% (i) #要压缩的文件夹路径 file_news = startdir + '. Zip ' # After compressing the folder's name print (file_news) z = zipfile. ZipFile (File_news, ' W ', ZipFile. zip_deflated) #参数一: folder name for Dirpath, Dirnames, filenames in Os.walk (startdir): Fpath = Dirpath.replace ( Startdir, ') #这一句很重要, without replace, start copying from the root directory Fpath = Fpath and Fpath + os.sep or ' ' #这句话理解我也点郁闷, implementing compression for the current folder and all contained files for filename in filenames: z.write (Os.path.join (dirpath, filename), fpath+filename) print (' compression succeeded ') z.close () print (file_news+ ' End ')
Python download Wunda deep learning programming exercises