I want to know what is the diff between two string operations in python
filestamp = time.strftime('%Y-%m-%d')
database = "mysql";
Between this
filename = "/home/vmware/%s-%s.sql" % (database, filestamp)
and
filename = "/home/vmware/"+database+"-"+filestamp+".sql"
String interpolation using the ‘%’ operators take the types of the interpolated values into account. String concatentation using the ‘+’ will only work for strings. So you can’t mix strings with numbers using the ‘+’ operator. In general: string interpolation is what you want – at least for building strings from other values especially if you deal with different types.