我如何在序言中打印空格

问题描述 投票:0回答:1

我需要使用write()打印到流中,但是我不知道如何打印'空白'空格。例如我想写

       10    3     
   5     3    6

write('10 3')只写10 3(删除多余的空格),我想打印前导空格。有人知道我该怎么做吗?

prolog swi-prolog
1个回答
0
投票

请使用我们可以运行的完整程序来编辑您的问题,以及您获得的输出以及您想要获得的输出。

这似乎在SWI-Prolog 7.6.4上对我有用:

?- write('10 3'), nl, write('    10    3    '), write('7'), nl.
10 3
    10    3    7
true.
© www.soinside.com 2019 - 2024. All rights reserved.