我在 .txt 文件中有以下数据:
1|John Smith|123 Here Street|456-4567
2|Sue Jones|43 Rose Court Street|345-7867
3|Fan Yuhong|165 Happy Lane|345-4533
Run Code Online (Sandbox Code Playgroud)
我获取数据并使用以下代码将其转换为向量:
(def custContents (slurp "cust.txt"))
(def custVector (clojure.string/split custContents #"\||\n"))
(def testing (into [] (partition 4 custVector )))
Run Code Online (Sandbox Code Playgroud)
这给了我以下向量:
[(1 John Smith 123 Here Street 456-4567) (2 Sue Jones 43 Rose Court Street
345-7867) (3 Fan Yuhong 165 Happy Lane 345-4533)]
Run Code Online (Sandbox Code Playgroud)
我想将其转换为这样的向量向量:
[[1 John Smith 123 Here Street 456-4567] [2 Sue Jones 43 Rose Court Street
345-7867] [3 Fan Yuhong 165 Happy Lane 345-4533]]
Run Code Online (Sandbox Code Playgroud) 我是编码初学者,目前我正在尝试从我的 json 文件中获取信息并在 html 中创建一个表。我正在使用原子代码编辑器,我试图让 javascript 遍历所有数据以通过使用 jQuery 来制作表格。我曾无数次尝试使用 jquery 从我的 json 文件中提取信息,但我似乎做错了什么。我浏览了很多论坛并尝试了不同的代码,但它们似乎都不起作用。Json 代码如下。谢谢。
[
{
"Season": 2006-2007,
"Team": "P4two Ballers Osnabrueck",
"Games": 32,
"FG%": 65,
"FT%": 71,
"Assists": 4.5,
"Steals": 1.8,
"Blocks": 1.5,
"TRB": 11.9,
"Points Per Game": 16.7
},
{
"Season": 2007-2008,
"Team": "TG Renesas Landshut",
"Games": 26,
"FG%": 67,
"FT%": 68,
"Assists": 5,
"Steals": 1.2,
"Blocks": 0.8,
"TRB": 16.3,
"Points Per Game": 14.5
},
{
"Season": 2008-2009,
"Team": "Head Attack Erding",
"Games": 20,
"FG%": 69,
"FT%": 75, …Run Code Online (Sandbox Code Playgroud)