batch mkdir using a file list
__peter__ at web.de
Fri Sep 23 22:11:03 CEST 2005
> I am using bash shell on windows and I'm getting the error:
> TypeError: loop over non-sequence
Use open(filename).readlines() instead of open(filename) or switch to a
current Python version.
> OR...if python can't handle this type of text file,
> what do I need to do to remove the "\n" from the file?
line.strip() removes all leading and trailing whitespace (not just "\n")
from the line string.
for line in open("list.txt").readlines():
directory = line.strip()
More information about the Python-list