【发布时间】:2012-01-09 01:33:15
【问题描述】:
我想在不带任何逗号的字符串中添加内容。
我有一个字符串 URL: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')
这只是一个字符串。有什么帮助吗?!
【问题讨论】:
-
线索已经在你的代码中了。看看你的输出。在字符串构造中使用变量
time_str的方式有什么不同?
标签: python