I haven't used str.format() much before and am wondering how to pass in list values and retrieve a list output with these values passed in.
i.e.
listex = range(0, 101, 25)
baseurl = "https://thisisan{0}example.com".format(*listex)
I'd like a list output like ["https://thisisan0example.com", "https://thisisan25example.com", "https://thisisan50example.com", etc etc]
but with my current code above, I'm only getting "https://thisisan0example.com" when I run print baseurl
You cannot get your output as shown using a single format. You can use a list-comp
You can use
maphere (if you are using Py3, wrap alistcall),This can then be stored in your variable
baseurlasThe speed comparision can be done using
timeitAs you can see, the
mapis faster here (Python2) as there is no involvement of alambda