G'day all
Can anyone explain the difference in the results to me as I don't understand why specifying the directory name in two different ways could give a different answer.
In CODE 1 below i specified the directory path in the code.
In CODE 2 below i specified the directory path through a wxPython dialog.
When I run CODE 1 I get the following:
['d:\\temp,20070 512_xfer_2_CA.p df',...
User Profile
Collapse
-
Try: Except: not catching ValueError (Help)
G'day all
In the code below I am trying to catch an error thrown if i enter any other value than an integer. (I used the string 'six' and the float '1.5')
The error thrown in the command window by the code is:
Traceback (most recent call last):
File "C:\Documen ts and Settings\Smythv ille\My Documents\Pytho n\Stuff\Ch4\ex1-6.py", line 59, in <module>
a = int(raw_input(" \nTry... -
Thanks for answering bvdet.
I used your code and played around with it to see how the os.walk function worked. If I am not mistaken the os.walk function walks down through the directories from the path supplied and creates a list as follows (Directory path,[subdir1,subdir2],[filename1,filen ame2]).
After looking at what os.walk returns I can see that what I was trying to do in the first post is not correct. What I was... -
Writing a list to A CSV file (Newbie needs help)
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"))...
No activity results to display
Show More
Leave a comment: