stackoverflow_user1
stackoverflow_user1

Reputation: 231

adding to a string without commas

I want to add things to a string without any commas.

I have a string 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

it prints like this

('http://gdata.youtube.com/feeds/api/standardfeeds/', 'top_rated', '?max-results=', '5', '&time=today')

and I want it to print like this:

('http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?max-results=5'&time=today')

which is just one string. Any help?!

Upvotes: 0

Views: 1308

Answers (3)

gecco
gecco

Reputation: 18840

String concatenation is what you are looking for and SO has many threads on this topic ( String concatenation vs. string substitution in Python , Concatenation Operator + or , ,...)

Upvotes: 2

jonathan.hepp
jonathan.hepp

Reputation: 1643

Simply remove the commas on the web_str and put the signal '+' in their places.

Upvotes: 0

Timothy Groote
Timothy Groote

Reputation: 8643

Here's a hint ; you are looking for a way to concatenate strings.

Upvotes: 3

Related Questions