Erlang:输出问题 [英] Erlang: Output Problem

查看:155
本文介绍了Erlang:输出问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的erlang Web应用程序中,有一个列表,其中包含要打印在网页上的整数。
但是当脚本执行时,它打印出来,而不是实际的列表,



请看这个显示unicode代码点1,1,2,3,5,8,空格,代码点15的字符的图像



如何格式化以获得我想要的?
目标列表是[1,1,2,3,5,8,13,15]

解决方案

应该这样做:

  P = [1,2,3,5,8,13,15],
Show_on_page = io_lib:format(〜p,[P]),
Show_on_page。

这将代表您希望看到的任何Erlang术语。 >

In my erlang web application, there is a list, which contains integers to be printed on the web page. But when the script executes, it prints this, instead of actual list,

Please look at this Image showing characters for unicode codepoint 1, 1, 2, 3, 5, 8, whitespace, codepoint 15

How to format this to gain what I want? Target list is [1, 1, 2, 3, 5, 8, 13, 15]

解决方案

You should do this:

P = [1, 1, 2, 3, 5, 8, 13, 15],
Show_on_page = io_lib:format("~p",[P]),
Show_on_page.

This will represent any Erlang term on the web page the way you want to see it.

这篇关于Erlang:输出问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆