tags:

views:

966

answers:

4

I see you guys using

url = '"%s"' % url # This part

>>> url = "http://www.site.com/info.xx"
>>> print url
http://www.site.com/info.xx
>>> url = '"%s"' % url
>>> print url
"http://www.site.com/info.xx"

Is it advanced Python? Is there a tutorial for it? How can I learn about it?

+1  A: 

It is not advanced, you can use ' or " to define a string.

Check the documentation.

Andrea Ambu
+8  A: 

That line of code is using Python string formatting. You can read up more on how to use it here: http://docs.python.org/library/stdtypes.html#string-formatting

Daniel Lew
+1  A: 

No, but // for comments sure is advanced Python. Try a # prefix for comments.

Mat
LoL. The syntax highlighter is having problems I guess.
Andrea Ambu
+5  A: 

It's common string formatting, and very useful. It's analogous to C-style printf formatting. See String Formatting Operations in the Python.org docs. You can use multiple arguments like this:

"%3d\t%s" % (42, "the answer to ...")
dwc