I want to get the following output:
"my_www.%first_game_start_time%("REN", "233_736")"
Would you please tell me what is wrong in code below:
u = "my_www.%%first_game_start_time%%(%s, %s)" %("REN", "233_736")
Best Regards
I want to get the following output:
"my_www.%first_game_start_time%("REN", "233_736")"
Would you please tell me what is wrong in code below:
u = "my_www.%%first_game_start_time%%(%s, %s)" %("REN", "233_736")
Best Regards
If you are asking how to embed " in the string, triple quotes is an easy way
u = """my_www.%%first_game_start_time%%("%s", "%s")"""%("REN", "233_736")
Another way is to escape the " with a \
u = "my_www.%%first_game_start_time%%(\"%s\", \"%s\")"%("REN", "233_736")
Since you have no ' in the string, you could also use those to delimit the string
u = 'my_www.%%first_game_start_time%%("%s", "%s"))'%("REN", "233_736")
u = """my_game.%%first_game_start_time%%("%s", "%s")""" %("ISS", "320_757") what is wrong with this one?my_game.%first_game_start_time%("ISS", "320_757"). Is that not what you were expecting?"my_game.%first_game_start_time%("ISS", "320_757")". But it doesn't output that. Instead, it outputs the previous value assigned to u."%s" is unlikely to be what is desired, in my opinion. Doing that sort of thing is what leads to bugs and related security holes. Do something which makes sure that stray ' or " characters won't cause trouble. Python's string repr is one such, which can be invoked as %r in string formatting.Generally you need to post your expected output and point out the difference between that and the output you receive, or include an error message you are receiving, to get a usable answer. But, I suspect the problem is that you want the value of c to be inserted into the string u and instead the literal letter c is being inserted. If that is the case, the solution is:
c = "222"
u = "my_www.%%first_game_start_time%%(%s, %s, %s)" %("REN", "233_736", c)