On Monday, June 2, 2014 7:48:25 PM UTC+5:30, Samuel Kamau wrote: > I have created a txt file with various paths to directories. The paths look > like this > > /home/wachkama/Desktop/api/genshi > > /home/wachkama/Desktop/www/portal/schedule > > /home/wachkama/Desktop/show/help.genshi > > > > How do i read this paths in python ?
for x in open("filenames.txt"): print x Assuming your filenames are in a file called filenames.txt in current directory Also in practice: 1. You probably want print x.strip() 2. You dont want a print but whatever is the code you want -- https://mail.python.org/mailman/listinfo/python-list