【问题标题】:How to print in the same line in AMPL如何在 AMPL 的同一行中打印
【发布时间】:2019-10-09 17:22:24
【问题描述】:

大家晚上好!我有这个愚蠢的问题,但我在语言手册中找不到解决方案。它开始似乎是不可能的。到目前为止,我一直在尝试使用:

print "Write something";
print "This is not in the same line";

我知道我可以将字符串与& 连接起来,但这并不能解决我的用例。有谁知道如何在 AMPL 的同一行打印?

【问题讨论】:

    标签: ampl


    【解决方案1】:
    printf "Write something";
    printf "This is in the same line";
    printf "\nThis is a new line";
    

    有关选项的更多详细信息,请参阅AMPL printf documentationprint 适用于简单的输出语句,printf 为您提供更多功能来微观管理输出的打印方式。

    【讨论】:

    • 生活改变者。将它与变量一起使用的方法是:printf "Whatever %u", varname 以防万一有人在看它。非常感谢。
    猜你喜欢
    • 2021-05-23
    • 2021-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-20
    • 1970-01-01
    • 2022-10-23
    相关资源
    最近更新 更多