Im looking to replace the first "/" in a string and the following works. Python3
>>> u'/test/test.json'.replace('/', '', 1)
'test/test.json'
However I do sometimes come across the following strings, where a "/" character exists but not as the first character. I only ever want to remove that character if it appears as the first character and only the first occurrence also.
>>> u'test/test.json'.replace('/', '', 1)
'testtest.json'
So test/test.json should remain test/test.json