Casual Literary Notes

查看 Windows 是否正版及其激活途径:
Win + R 后输入:slmgr.vbs -dli

其中:

image-20250625184911474


image-20250625184946183


# 以二进制形式合并两个文件,可用来做图种
copy /b <absolute path of a file> + <absolute path of another file> <absolute path of destination>

Python will check for SyntaxErrors before executing any code. This is different from other errors, which are only raised during runtime.

A common bug is to leave off the closing parenthesis. This will show up as a SyntaxError. Consider the following code:

def fun():
return foo(bar() # missing a parenthesis here

fun()

Python will raise a SyntaxError, but will point to the line after the missing parenthesis:

File "file name", line "number"
fun()
^
SyntaxError: invalid syntax

In general, if Python points a SyntaxError to a seemingly correct line, you are probably forgetting a parenthesis somewhere.

This is similar to the previous bug, but much easier to catch. Python will actually tell you the line that is missing the quote:

File "file name", line "number"
return 'hi
^
SyntaxError: EOL while scanning string literal

EOL stands for “End of Line.”