Python语法错误,找不到拼写错误的内容
我的pythonsocket程序中有这行代码,但它抛出了一个语法错误,看在上帝的份上,我找不到拼写错误的地方Python语法错误,找不到拼写错误的内容,python,sockets,syntax-error,Python,Sockets,Syntax Error,我的pythonsocket程序中有这行代码,但它抛出了一个语法错误,看在上帝的份上,我找不到拼写错误的地方 conn.send(f'{os.path.getsize(f'{os.path.curdir}\\{filename}')}.encode(格式)) 下面是VisualStudio代码中的“偷窥问题”屏幕截图 无需嵌套f字符串: import os filename = "foo.txt" x = f"{os.path.getsize(os.path.j
conn.send(f'{os.path.getsize(f'{os.path.curdir}\\{filename}')}.encode(格式))
下面是VisualStudio代码中的“偷窥问题”屏幕截图
无需嵌套f字符串:
import os
filename = "foo.txt"
x = f"{os.path.getsize(os.path.join(os.path.curdir, filename))}"
print(x)
输出:
嵌套的
“
s?
7