2017-08-25 8 views
-4

luaに相当するPythonテーブルはありますか?Pythonに相当するLuaのテーブル

-- Lua's Table 
a = {} 
a.x = 10 
a.y = 10 
print(a.x) 
print(a.y) 

-- OUTPUT 
10 
10 
+0

あなたの質問にお答えできますか、私はあなたが探しているものを理解していません –

+1

あなたは[辞書]を探しています(https://docs.python.org/3/tutorial/datastructures.html#辞書)。 More [docs here](https://docs.python.org/3/library/stdtypes.html#mapping-types-dict) –

答えて

0
a = {} 
a["x"] = 10 
a["y"] = 10 
print(a["x"]) 
print(a["y"]) 

# OUTPUT 
10 
10 

あなたが話している何本か?

+1

こちらは、これも有効なLuaコードです... – lhf

+0

Sweet。ありがとうございました! – flawy

関連する問題