python - creating directories from for loop -
I need to create a directory with loop. I have a list.
  a = [Banana 1234, Sep 456, orange 789]    And I need to make folders by the names of those numbers with numbers in the list Finished for example.  
  c: \ folder \ 1234; C: \ folder \ 456    and so on. Atrinkta for length  
 code  
  is: folder = re.findall (r '\ d {9,}', length) os.makedirs ("D: / Python_study / images / skelbimai / "+ folder)    but I get an error " Type error: can not add 'str' and 'list' objects " / strong> Do not know what to do. Any help please    edit  I tried my method a second time, after deleting the created folder for whatever reason, Python gives me an error    WindowsError: [Error 183] The file that already exists when a file can not be created: 'D: / python_study / images / skelbimai /'     2ndEdit    shaktimaan, I get another error now  AttributeError: There is no attribute 'group' in 'NoneType' object . what does it mean?    
  try it  
  for length in atrinkta: folder = re.search (r '(\ d +)', length) os.makedirs ("D: / python_study / images / skelbimai /" + folder.groups () [0])    
 
Comments
Post a Comment