[Pythonmac-SIG] Strange ?
Francois Granger
fgranger@altern.org
Sun, 3 Feb 2002 18:16:44 +0100
I did a simple script to work info inside some files. It gave me
strange results, so I have reduced it to the bare script needed to
show the behaviour.
Config: MacOS 9.1, Python 2.2
Make this script an applet and drop the filenames showed in the list.
All filenames are different. I expect it to return the full filename
plus a space unless the filename is longer than 30 char. In this
case, it should return the first 30 char plus a space. But it return
only the first word of the name plus a space.
I did test with
files = os.listdir(os.getcwd())
and I did not get the same behaviour.
# python
import sys, re, os
print sys.argv[1:]
files = sys.argv[1:]
for file in files:
out = file[:30] + ' '
print out
output of the script below.
====================================================
['HD:Dev:stats usenet:Classement hebdo020118', 'HD:Dev:stats
usenet:Classement hebdo020125', 'HD:Dev:stats usenet:Classement
hebdo020201', 'HD:Dev:stats usenet:Classement mensuel 0201',
'HD:Dev:stats usenet:Classement hebdo020111']
HD:Dev:stats usenet:Classement
HD:Dev:stats usenet:Classement
HD:Dev:stats usenet:Classement
HD:Dev:stats usenet:Classement
HD:Dev:stats usenet:Classement
====================================================