Alan Gauld wrote:

"David" <da...@abbottdavid.com> wrote

Forwarded to the list, I would also like to understand the forward slash;
os.system("mv %s/%s %s" % (src, fnames, dst))

The slash separates the file path, src,  from the filename.

Thus if src is /foo/bar/baz
and fnames is spam

then %s/%s becomes

/foo/bar/baz/spam

Another way of doing the same thing would be with join:

'/'.join([src,fnames])

or for platform independance:

os.sep.join([src,fnames])

HTH,

Thank you Alan, you are a very good teacher, you should write a book :)

--
Powered by Gentoo GNU/Linux
http://linuxcrazy.com
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to