Hi Ziyad thank you very much! E.
Цитат на писмо от ???? ?? ????????? ??????? <[EMAIL PROTECTED]>: > On Thu, 2006-07-20 at 11:19 +0300, [EMAIL PROTECTED] > wrote: > > Hi, > > > > is this the right (shortest) way to get the file > extention > > (under MS WIN)? > > > > > > def getext(fname): > > ext = fname.split('.').pop() > > return ext > > > > Regards, > > Emily > > > The following maybe a little better: > def getExt(fname): > return fname.rsplit('.', 1)[1] > > It uses one method instead of two compared to yours. And > in your code > there's no need for the ‘ext’ variable, you could use: > def getext(fname): > return fname.split('.').pop() > > For more information about ‘str’ objects type the > following inside the > Python shell: > >>> help(str) > > > Ziyad. > > > ----------------------------- Спортни залагания! bg.sportingbet.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor