home > 比較編 > Perl, PHP, Python, Ruby > dictionaries >

ForNext

Only Do What Only You Can Do

132. from array of pairs, from even length array

VBScript

JScript

Perl

@a = (1,"a",2,"b",3,"c");
%d = @a;



PHP

Python

a = [[1,'a'], [2,'b'], [3,'c']]
d = dict(a)

a = [1,'a',2,'b',3,'c']
d = dict(zip(a[::2], a[1::2]))

Ruby

a = [[1,"a"], [2,"b"], [3,"c"]]
d = Hash[a]

a = [1,"a",2,"b",3,"c"]
d = Hash[*a]

PowerShell

Scala

F#

C

C++

C++Builder

VC++

C#

Java

Objective-C

D

VB

VB.NET

Delphi

Ada

PL/SQL

T-SQL

関数型

inserted by FC2 system