Created
April 15, 2019 18:36
-
-
Save PaulGwamanda/9b56eb04776f053e7a489758f8828857 to your computer and use it in GitHub Desktop.
Create new item for every item found in a list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ie List is a normal list: | |
# 104.txt | |
# 105.txt | |
# 106.txt | |
# 107.txt | |
# 108.txt | |
# When done with code below should give me 5x files with a .txt extension, ie 104.txt, 105.txt. Can be any file ext. | |
List = open("64-120/rename.txt") | |
List2 = (s.strip() for s in List) | |
# Loop through the list and create a file with item | |
for item in List2: | |
open('64-120/%s.txt'%(item,), 'w') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment