在字符串中添加无逗号内容
我想在一个字符串里添加东西,但不想要任何逗号。
我有一个字符串网址:http://gdata.youtube.com/feeds/api/standardfeeds/feed_str?max-results=max_result&time=
feed_str = top_rated
max_result = 5
time_str = today
web_str = "http://gdata.youtube.com/feeds/api/standardfeeds/",feed_str, "?max-results=" ,max_result,"&time=" + time_str
它打印出来是这样的:
('http://gdata.youtube.com/feeds/api/standardfeeds/', 'top_rated', '?max-results=', '5', '&time=today')
而我想让它打印成这样:
('http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?max-results=5'&time=today')
这只是一个字符串。谁能帮帮我?!
3 个回答
0
简单来说,就是把web_str
里的逗号去掉,然后在它们的位置上放一个信号'+'
。
2
你需要的就是字符串连接,在StackOverflow上有很多关于这个话题的讨论(比如 Python中的字符串连接与字符串替换, 连接运算符 + 或 ,,等等)。
3
这里有个提示;你需要找到一种方法来连接
字符串。