How to get URL without path in Python?

How to get URL without path in Python?

RegEx(Regular Expression) can be used to get URL without path in Python.

Sample Code:

import re
serverUrl = 'https://infallibletechie.my.salesforce.com/services/Soap/c/29.0/00Di0000000icUB/0DFi00000008UYO';
strURL = re.findall( "(https://.*?)/", serverUrl )[ 0 ];
print( 'strURL is', strURL );

Output:

Leave a Reply