Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put string in a set as an individual item?

Tags:

I have a string

sample = "http://www.stackoverflow.com"

I want convert this string to a set

final = {"http://www.stackoverflow.com"}

I tried the following code:

final = set(sample)

But i got the wrong out as

{u'.', u'/', u':', u'a', u'b', u'c', u'e', u'h', u'i', u'k', u'l', u'n', u'p', u's', u't', u'w'}

I also used

final  = ast.literal_eval(Sample)

and I got this

SyntaxError: invalid syntax

Is there any other solution for this