Coding Anytime Anywhere

Coding Anytime Anywhere

(for x <- [<<65>><>"ny"], y <- ~w(time where), do: x <> y)
|> Enum.reduce('Co'++~c(deing)--[101], &([&2|["\s"|&1]]))
|> IO.puts

Data Transform

File.read!("./data.txt") 
|> String.split("\n") 
|> Enum.map(fn x -> {:ok, date, _} = DateTime.from_iso8601("2019-08-12T" <> x <> "Z"); date end) 
|> Enum.group_by(fn x -> x end) 
|> Enum.map(fn {k, v} -> [k, length(v)] end) 
|> Enum.sort(fn l, r -> l <= r end) 
|> Enum.reduce("", fn x, acc -> d = Enum.at(x, 0); acc <> "#{d.year}/#{d.month}/#{d.day} #{d.hour}:#{d.minute}:#{d.second}" <> ", #{Enum.at(x, 1)}"  <> "\n" end) |> (fn s -> File.write("./data.csv", s) end).()
更新时间: 20个月前 版本: 5059d673

This work is licensed under a CC BY-NC-ND 4.0

Related posts recommended

Get weekly updates, right in your mailbox