Le Sun, 1 Feb 2009 02:44:02 +0800, Jay Jesus Amorin <jay.amo...@gmail.com> a écrit :
> Thanks bob. > > I want to search any characters in test after > https://www.localhost.org/<https://www.localhost.org/testmodule/dev/trunk/admin/sql/mytest.sql>and > the search will end after it finds another / > > and when i print it will display *testmodule*. > > Newbie, > > Jay I think your question is not of string formatting, rather of string parsing, meaning identifying parts of string according to a given format. I your case, you want a function that able to extract a substring that: * starts with "test" * ends with "/" You can do this step by step using simple string method 'find', and slicing: * find the (position of the) first occurrence of "test" * find the (position of the) first occurrence of "/", after "test"'s position * extract the slice defined by these positions Denis ------ la vida e estranya _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor