AFAIK,Python(v2.6)csv模块默认不能处理unicode数据,对吗?在Python文档中有一个关于如何从UTF-8编码文件中读取的示例.但是此示例仅将CSV行作为列表返回.我希望按名称访问行列,csv.DictReader但是使用UTF-8编码的CSV输入文件.
谁能告诉我如何以有效的方式做到这一点?我将不得不处理100个MByte大小的CSV文件.
Python有IPython .. OCaml有类似的东西吗?
我非常想拥有命令历史,虽然其他功能也会很好.我已经读过,我可以通过在Emacs中运行来获取命令历史记录,但我不使用Emacs ..
所有,
我希望以15-60分钟的间隔从雅虎或谷歌下载股票数据,以获得尽可能多的历史记录.我想出了一个粗略的解决方案如下:
library(RCurl)
tmp <- getURL('https://www.google.com/finance/getprices?i=900&p=1000d&f=d,o,h,l,c,v&df=cpct&q=AAPL')
tmp <- strsplit(tmp,'\n')
tmp <- tmp[[1]]
tmp <- tmp[-c(1:8)]
tmp <- strsplit(tmp,',')
tmp <- do.call('rbind',tmp)
tmp <- apply(tmp,2,as.numeric)
tmp <- tmp[-apply(tmp,1,function(x) any(is.na(x))),]
Run Code Online (Sandbox Code Playgroud)
鉴于我想要导入的数据量,我担心这可能在计算上很昂贵.我也不了解我的生活,了解雅虎和谷歌的时间戳是如何编码的.
所以我的问题是双重的 - 将一系列股票的数据快速提取到R中的简单,优雅的方法是什么,以及如何解释我将使用的Google/Yahoo文件的时间戳?
每次我在解释器中使用这些键时,我都会看到这样的符号出现:
[[D^[[C
Run Code Online (Sandbox Code Playgroud)
我在ZSH中使用Linux Mint 12,但是我在使用bash的Ubuntu中获得了相同的结果.另外,在ssh中也是如此.
注意:标记为社区维基
我在vim中编码.
我用git; 并且喜欢git grep.
有没有人有一套特别好的技巧/脚本在vim中使用git grep?
读者:请upvote涉及vim + git grep的答案; 请关注非vim编辑的答案,以及除git grep之外引用外部工具的编辑.
I am trying to compile the source code of MEGAM Ocaml library on an Ubuntu 64 machine.
I have OCaml installed (v 3.12.1), using sudo apt-get install ocaml.
I am having an issue when running the "make" command in the terminal on the unzipped source code, with OCaml returning the error:
/user/bin/ld: cannot find -lstr
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
The makefile is producing the following two commands:
ocamldep *.ml > .depend
Run Code Online (Sandbox Code Playgroud)
No error when run
ocamlc …
我试图subprocess使用以下行管道输入:
p.communicate("insert into egg values ('egg');");
TypeError: must be bytes or buffer, not str
Run Code Online (Sandbox Code Playgroud)
如何将字符串转换为缓冲区?
我正在尝试编写一个模块,在另一个模块上实现算法,可以通过各种方式实现.所以我的想法是把第一个模块写成
module type Base = sig
type t
val f : t -> t
end
Run Code Online (Sandbox Code Playgroud)
然后我写了第二个模块,该模块通过与Base以下模块兼容的模块进行参数化:
module type BasedOnBase = functor (B : Base) -> sig
type b
val g : B.t -> b
end
Run Code Online (Sandbox Code Playgroud)
现在我正在尝试编写一个模块,该模块通过兼容的模块进行参数化BasedOnBase,这就是我遇到的问题.我的天真方法不起作用,我试过了
(* won't compile *)
module type Alg = functor (BoB : BasedOnBase) -> sig
val h : BoB.b -> bool
end
Run Code Online (Sandbox Code Playgroud)
以及
(* won't compile *)
module type Alg = functor (BoB : functor (B : Base) -> BasedOnBase) -> …Run Code Online (Sandbox Code Playgroud) 关于静态与动态类型的SO有很多问题,但我没有找到很多关于同时具有这两种语言的语言.让我解释.
似乎动态类型语言在快速原型设计方面具有优势,例如Python或Perl,而静态类型语言(如C++,OCaml)允许更多的编译时检查和优化.我想知道是否有一种语言允许两者:
在C#中,默认是静态类型,但您可以编写:
dynamic fooVar = new FooClass();
Run Code Online (Sandbox Code Playgroud)
在这种情况下fooVar是动态类型.
似乎OCaml与http://www.lexifi.com/blog/runtime-types也提供类似的东西.
请不要主观建议哪种语言最好,只有客观特征!