I am trying to create directory recursively using a Python script, but am getting and error.
Code:
import os a = "abc" os.makedirs('/root/test_{}'.format(a), exist_ok=True) Error:
Traceback (most recent call last): File "mk.py", line 3, in <module> os.makedirs('/root/test_{}'.format(a), exist_ok=True) TypeError: makedirs() got an unexpected keyword argument 'exist_ok'
I am using python2.7 and the above option does not work in this version? If not, what is alternate solution?
exist_okis "new" in version 3.2