Gabriele Brambilla wrote: > 2014-06-05 22:10 GMT-04:00 Peter Romfeld <peter.romfeld...@gmail.com>: > > On Friday, June 06, 2014 10:04 AM, Gabriele Brambilla wrote: >>> >>> fiLUMOname = 'Lsum_' + period + '_' + parts[2] + '_' + parts[3] + '_' >>> + parts[4] + '_*.dat' >>> >>> aaa = glob.glob(fiLUMOname) >>> print(aaa) >>> fiLUMO = open(aaa[0], 'r') >> >> i would do: >> >> aaa = glob.glob('Lsum_%s_%s_%s_%s_*.dat' % (period, parts[2], parts[3], >> parts[4])) > > thanks, it works.
While Peter's way may be easier to read both approaches should give you the same result, assuming 'period' and the items in the 'parts' list are all strings. There must be an accidental change elsewhere -- maybe you changed the current working directory before invoking the script? _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor