China Naming Network - Feng Shui knowledge< - Find a txt file, read the names in the document with python, and then create multiple folders named after the created folders.

Find a txt file, read the names in the document with python, and then create multiple folders named after the created folders.

The code is as follows, as simple as that:

Import? Operating System (operating system)

basepath? =? c:\ data ';

For what? Line? Are you online? Open ('a.txt'):

basename? =? line.strip()

Folder? =? os.path.join(basepath,? Basic name)

File name? =? Os.path.join (folder,? Basic name)

Os.mkdir (folder)

Open (file name, w'). Dear () hope to adopt, thank you for your support!