我在Python中有这个代码,我必须在C++中翻译,但我被困了,因为我不能理解如何在Python中初始化一个类似的列表,以及如何在一个文件中像下面的代码
写def to_file(sy, ey, sx, ex, name, dor):
rBloc = ["LINE\n", "8\n", str(dor) + "\n",
"10\n" + str(sx) + "\n" + "11\n" + str(ex) + "\n" +
"20\n" + str(sy) + "\n" + "21\n" + str(ey) + "\n" +
"0\n"]
with open(files.result_directory + r"\box_" + name[:-1] + ".dxf", "a") as f:
for i in rBloc:
f.write(str(i))
可以使用C++向量替换Python中的列表。整个代码将如下所示
相关问题 更多 >
编程相关推荐