New to Python and programming.

I want to start with a txt file with different names per line
Output a program that will create a directory for each entry in txt file

I'm having problems getting txt file values into Python list, and using that as input for directory name, then creating directory.

Any help please? I would greatly appreciate it.

We help you preferably to finalize your working or mostly working code, but if you are really stuck in some places on the way and show reasonable effort to debug those, we can give hints or warnings of bad approach to you. Basically we want to support members learning and understanding.

To begin we need to know what have you tried and where are you stuck. If you post whatever code you've written we can help you fix it. It's also a good way to guage how much you already know and what level of details should be included in the response.
Edit: @pyTony beats me to ..

Edited 4 Years Ago by Agni

Thanks guys for reading and trying to help.

I tried the readlines to get them into to the program, an no error and put a print line to test if it worked, it printed names from the txt file but added "-n" to all names.

I'm undrer the impression that f.readlines imports them into python as a list to use for input for making the directory/subdirectory subroutine.

I have no experience in Python and only little with BASIC.

I'm stuck on creating the dir/subdirs also.

Open the file with read only permit

f = open('C:\python\names.txt')

Read the first line

line = f.readlines()
print line
f.close()

This article has been dead for over six months. Start a new discussion instead.