执行字符串格式化{Python,Windows 10}时出现值错误
我的代码:执行字符串格式化{Python,Windows 10}时出现值错误,python,string,Python,String,我的代码: print(“{:以下内容将引发ValueError:未知格式代码异常: n = 8 print("{:<n}world".format("hello")) print(f"{{:<{n}}}world".format("hello")) hello world
print(“{:以下内容将引发ValueError:未知格式代码
异常:
n = 8
print("{:<n}world".format("hello"))
print(f"{{:<{n}}}world".format("hello"))
hello world