ragrwal

Getting All answers from directory

Sep 17th, 2021
978
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from os import listdir
  2. from os.path import isfile, join
  3.  
  4. FilePathDict = {}
  5.  
  6. #word_freq.update({'before': 23})
  7.  
  8.  
  9. mypath = r"C:\Users\Rohan\Downloads\dinner-coding-time-master\dinner-coding-time-master\public\codehs"
  10. onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
  11. print(onlyfiles)
  12. mypath += '\java'
  13. print(listdir(mypath))
  14. javalist = listdir(mypath) #list of folders n files inside of the java folder
  15. tmp = mypath #temp file of main path for appending purposes
  16. for item in javalist:
  17.     if item.isdigit():
  18.         print(item)
  19.         tmp += '\\' + item
  20.         print(listdir(tmp))
  21.         tmp2 = tmp
  22.         for item2 in listdir(tmp):
  23.             tmp2 += '\\' + item2
  24.             print(listdir(tmp2))
  25.             tmp3 = tmp2
  26.             for item3  in listdir(tmp2):
  27.                 tmp3 += '\\' + item3
  28.                 print(item)
  29.                 print(item2)
  30.                 print(item3)
  31.                 tmp3 = tmp2
  32.                
  33.                
  34.             tmp2 = tmp
  35.  
  36.         tmp = mypath
  37.  
  38.  
  39.  
RAW Paste Data