G'day All
I am just starting to learn programming and need a bit of help with this one.
I want to be able to create a list containing Path, Directory, Filename and write them out to a csv file (ie path,dir,file). This is what i have so far:
import os
import csv
writer = csv.writer(open ("C:\Documen ts and Settings\Smythv ille\My Documents\Pytho n\Stuff.csv", "wb"))
for root, dirs, files in os.walk('C:\Doc uments and Settings\Smythv ille\My Documents\BitTo rrent Downloads'):
writer.writerow s(root, dirs, files)
f.close()
When i run it in the command window i get this:
Traceback (most recent call last):
File "C:\Documen ts and Settings\Smythv ille\My Documents\Pytho n\Stuff\Walkdir _clean.py", line 7, in <module>
writer.writerow s(root, dirs, files)
TypeError: writerows() takes exactly one argument (3 given)
I understand that I am giving it the three args but how can it convert those args into a line in a csv file.
Please help
Thanks
Pete
I am just starting to learn programming and need a bit of help with this one.
I want to be able to create a list containing Path, Directory, Filename and write them out to a csv file (ie path,dir,file). This is what i have so far:
import os
import csv
writer = csv.writer(open ("C:\Documen ts and Settings\Smythv ille\My Documents\Pytho n\Stuff.csv", "wb"))
for root, dirs, files in os.walk('C:\Doc uments and Settings\Smythv ille\My Documents\BitTo rrent Downloads'):
writer.writerow s(root, dirs, files)
f.close()
When i run it in the command window i get this:
Traceback (most recent call last):
File "C:\Documen ts and Settings\Smythv ille\My Documents\Pytho n\Stuff\Walkdir _clean.py", line 7, in <module>
writer.writerow s(root, dirs, files)
TypeError: writerows() takes exactly one argument (3 given)
I understand that I am giving it the three args but how can it convert those args into a line in a csv file.
Please help
Thanks
Pete
Comment