在url python中添加一个字符串

我想在网址中间添加一个字符串.不知怎的,我的输出看起来像这样:

http://www.Holiday.com/('Woman',)/Beach
http://www.Holiday.com/('Men',)/Beach

它应该看起来像这样:

http://www.Holiday.com/Woman/Beach
http://www.Holiday.com/Men/Beach

我使用的代码如下所示:

list = {'Woman','Men'}
url_test = 'http://www.Holiday.com/{}/Beach'
for i in zip(list):
    url = url_test.format(str(i))
    print(url)

最佳答案 你也可以试试这个,请不要使用list作为变量名.

lst = {'Woman','Men'}
url_test = 'http://www.Holiday.com/%s/Beach'
for i in lst:
     url = url_test %i
     print url
点赞