It is difficult for me with the installation instruction in Python timeit.Timer (stmt, setup_stmt). I appreciate any help to save me from this difficult problem:
So my sniplet looks like this:
def compare(string1, string2):
I do not know how to avoid the metacharacter in the variable str1, str2 without changing their value in the installation statement:
"from __main__ import compare; p1=%s, p2=%s" % (str1,str2)
I tried a different combination, but always had the following errors: Syntax Error: cannot assign literal
SyntaxError: EOL when scanning a one-line string
Syntax Error: invalid syntax
source share