突然想開始記錄以前容易習慣性敲錯的代碼,歡迎回復各自的經歷,也許之後會開個倉庫~
python:
if "xx" or "yy" in something: ...
結果恆爲True,實際應該爲
if "xx" in something or "yy" in something: ...
# 如果量大,可寫
if any([pattern in something for pattern in ["xx", "yy", "zz" ...]]): ...
SQL:
update tb set xx='val1' and yy='val2' ...
實際上應該是
update tb set xx='val1', yy='val2' ...