【发布时间】:2023-03-11 15:20:02
【问题描述】:
谁能帮助我更改/组织log条目的逻辑
input_array = [
["2/6/2014", "13:31:12", "IN", "application1", "user1", "machine1"]
["2/6/2014", "13:31:12", "IN", "application2", "user2", "machine2"]
["2/6/2014", "13:31:52", "IN", "application3", "user3", "machine3"]
["2/6/2014", "13:38:37", "OUT", "application1", "user1", "machine1"]
["2/6/2014", "14:46:37", "OUT", "application2", "user2", "machine2"]
["2/6/2014", "15:56:37", "OUT", "application3", "user3", "machine3"]
]
如何访问此数组中的各个元素.. 例如2/6/2014 或application1?
当我执行input_array[1][4] 时,所需的输出是...
"application1" # and not 6 ... its giving me the 4 character in line 1
感谢您的帮助!
【问题讨论】:
-
什么是
line?使用该间距,您的代码无效。 -
即使你使那个特定的语法有效,你仍然会得到一个字符串而不是数组。
标签: ruby arrays multidimensional-array