Regexp problem when parsing a string

MRAB python at mrabarnett.plus.com
Sun Mar 21 19:31:31 CET 2010


Alessandro Marino wrote:
> I'm a beginner and I was trying to write a program to 
> parse recursively all file names in a directory specified as parameter. 
> The problem is that I get a "None" printed to stdout when a file is 
> positively matched. While when the file name doesn't match the regexp 
> the output seems ok. 
> 
> C:\>c:\python.exe g:\a.py sample
> ====> foo - bar.txt , first part is: foo
> None
> skipping: foo.txt
> 
> Instead I expect an output like this one:
> 
> C:\>c:\python.exe g:\a.py sample
> ====> foo - bar.txt , first part is: foo
> None
> skipping: foo.txt
> 
> Could anyone help me to figure out why "None" appears in the putput?
> 
> Thanks and regards,
> Ale
> 
It's caused by:

     print saveData(file, m)

The function saveData() returns None, which is then printed.



More information about the Python-list mailing list