"함수 var dump()"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
6번째 줄: 6번째 줄:
[[category: Perl]]
[[category: Perl]]
{{참고|Perl Dumper()}}
{{참고|Perl Dumper()}}
<source lang='Perl'>
<syntaxhighlight lang='Perl'>
use Data::Dumper;
use Data::Dumper;


16번째 줄: 16번째 줄:
#          'Address' => 'Naha, Okinawa'
#          'Address' => 'Naha, Okinawa'
#        };
#        };
</source>
</syntaxhighlight>


==PHP==
==PHP==
[[category: PHP]]
[[category: PHP]]
{{참고|PHP var_dump()}}
{{참고|PHP var_dump()}}
<source lang='php'>
<syntaxhighlight lang='php'>
$dict = array(
$dict = array(
   "ID" => 102,
   "ID" => 102,
36번째 줄: 36번째 줄:
#  string(13) "Naha, Okinawa"
#  string(13) "Naha, Okinawa"
# }
# }
</source>
</syntaxhighlight>


==Python==
==Python==
[[category: Python]]
[[category: Python]]
{{참고|파이썬 pprint()}}
{{참고|파이썬 pprint()}}
<source lang='Python'>
<syntaxhighlight lang='Python'>
from pprint import pprint
from pprint import pprint
dict = { }
dict = { }
49번째 줄: 49번째 줄:
pprint( dict )
pprint( dict )
# {'Address': 'Naha, Okinawa', 'ID': 102, 'Name': 'YONEZAWA Akinori'}
# {'Address': 'Naha, Okinawa', 'ID': 102, 'Name': 'YONEZAWA Akinori'}
</source>
</syntaxhighlight>


==Ruby==
==Ruby==
[[분류: ruby]]
[[분류: ruby]]
{{참고|루비 p}}
{{참고|루비 p}}
<source lang='ruby'>
<syntaxhighlight lang='ruby'>
a = [ "a", "b", "c" ]
a = [ "a", "b", "c" ]
p ("hello")
p ("hello")
67번째 줄: 67번째 줄:
p options
p options
# {:font_size=>10, :font_family=>"Arial"}
# {:font_size=>10, :font_family=>"Arial"}
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 02:33 판

var_dump
pprint


1 Perl

use Data::Dumper;

my $foo = {"ID"=>102, "Name"=>"YONEZAWA Akinori", "Address"=>"Naha, Okinawa"};
print Dumper($foo);
#$VAR1 = {
#          'Name' => 'YONEZAWA Akinori',
#          'ID' => 102,
#          'Address' => 'Naha, Okinawa'
#        };

2 PHP

$dict = array(
  "ID" => 102,
  "Name" => "YONEZAWA Akinori",
  "Address"=> "Naha, Okinawa"
);
var_dump($dict);
# array(3) {
#   ["ID"]=>
#   int(102)
#   ["Name"]=>
#   string(16) "YONEZAWA Akinori"
#   ["Address"]=>
#   string(13) "Naha, Okinawa"
# }

3 Python

from pprint import pprint
dict = { }
dict['ID'] = 102
dict['Name'] = 'YONEZAWA Akinori'
dict['Address'] = 'Naha, Okinawa'
pprint( dict )
# {'Address': 'Naha, Okinawa', 'ID': 102, 'Name': 'YONEZAWA Akinori'}

4 Ruby

a = [ "a", "b", "c" ]
p ("hello")
# "hello"
p 1
# 1
p nil
# nil
p [1,2,3]
# [1, 2, 3]
options = { font_size: 10, font_family: "Arial" }
p options
# {:font_size=>10, :font_family=>"Arial"}

5 같이 보기

6 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}