Jay Jesus Amorin wrote:
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*.

Ah. Much clearer.

header = "https://www.localhost.org/";
test = "https://www.localhost.org/foo/bar"; # we desire to extract 'foo'
start = len(header)
end = test[start:].find('/') + start
result = test[start: end]
print result

--
Bob Gailer
Chapel Hill NC
919-636-4239
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to