How would I decode the following string into normal text from javascript:
s = 'https:\/\/s3.amazonaws.com\/normal-example\/ft_43513_53175ec44096a.mov'
I am currently doing s.replace('\/','/'), but there must be a better way?
How would I decode the following string into normal text from javascript:
s = 'https:\/\/s3.amazonaws.com\/normal-example\/ft_43513_53175ec44096a.mov'
I am currently doing s.replace('\/','/'), but there must be a better way?
You want to use decode with 'string-escape':
In [1]: s = 'https:\/\/s3.amazonaws.com\/normal-example\/ft_43513_53175ec44096a.mov'.replace('\/', '/')
In [2]: s.decode('string-escape')
Out[2]: 'https://s3.amazonaws.com/normal-example/ft_43513_53175ec44096a.mov'
The official docs on str.decode are here.
The relevant portion is the [The purpose of string-escape is to] produce a string that is suitable as string literal in Python source code.