我已经谷歌搜索了一段时间,但我找不到一个函数读取文件的第一行.
我需要读取文本文件的第一行并从中提取日期.
新的perl.
我set -o vi在我的.bash_profile中使用vi绑定在我的bash shell中工作.但我似乎无法让他们在mysql命令行客户端工作.我只获得emacs样式绑定.你怎么做到这一点?
我也把这些行放在我的.inputrc中,但没有效果:
set editing-mode vi
set keymap vi
Run Code Online (Sandbox Code Playgroud) I have tried everything I can think of to get this to work, to no avail so here I am requesting suggestions on how to debug.
Firstly, runnning Ubuntu 11.10
Installed rvm:
$ bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Run Code Online (Sandbox Code Playgroud)
Installed readline using apt-get:
$ sudo apt-get install libreadline-dev
Run Code Online (Sandbox Code Playgroud)
Check for readline install:
$ dpkg --get-selections | grep readline
lib64readline-gplv2-dev install
lib64readline5 install
libreadline-dev install
libreadline5 install
libreadline6 install
libreadline6-dev install
readline-common install
Run Code Online (Sandbox Code Playgroud)
Install ruby, with readline support?
$ rvm install 1.9.2 …Run Code Online (Sandbox Code Playgroud) 我在Ubuntu Linux 11.04(natty)机器上的virtualenv中使用python 2.6.我在我的(django)python代码中有这个代码:
import pdb ; pdb.set_trace()
Run Code Online (Sandbox Code Playgroud)
为了启动python调试器(pdb).
直到今天,这个工作正常.但是现在当pdb启动时,它适用于调试,运行和断点等,但是当我按下up arrow显示上一个命令时,它打印^[[A而不是上升.当我输入内容并按下时Home,它会打印^[OH而不是移动光标.
我可以用完/ home/etc.在bash终端启动我的python django unittests(有pdb调用)很好.
这是怎么回事?我该如何修复我的pdb?我的readline有什么问题?
我在java 6. DataInputStream in = new DataInputStream(System.in);用于读取用户输入.不推荐使用readLine()时.阅读用户价值的工作是什么?
DataInputStream in = new DataInputStream(System.in);
int num;
try
{
num = Integer.parseInt(in.readLine()); //this works
num = Integer.parseInt(in); //just in doesnt work.
}
catch(Exception e)
{
}
Run Code Online (Sandbox Code Playgroud)
请在不推荐使用readLine()时解释.
我正在运行Ubuntu 11.04,当我尝试在以变量开头的路径上使用bash中的tab-completion时,我会看到一些奇怪的行为.如果我有TOP =/scratch,我尝试tab-complete:
cd $ TOP/foo
它变为:
cd\$ TOP/foo
我更喜欢它完成:cd $ TOP/foobar或cd/scratch/foobar但我会满足于它只是不改变线并要求我取消$.
有谁知道bash/readline在哪里我应该解决这个问题?
我如何映射jj到Escinputrc,以便使用GNU Readline(python,mongoshell,...)获取应用程序
所有在zsh上工作正常使用:
bindkey -M viins 'jj' vi-cmd-mode
Run Code Online (Sandbox Code Playgroud)
这是我目前的inputrc:
set editing-mode vi
set keymap vi
# turn off the stupid bell
set bell-style none
$if mode=vi
set keymap vi-command
"gg": beginning-of-history
"G": end-of-history
#"jj": vi-movement-mode
set keymap vi-insert
"\C-w": backward-kill-word
"\C-p": history-search-backward
$endif
Run Code Online (Sandbox Code Playgroud) 我需要在用python编写的程序中导入readline功能.我目前正在使用2.7版本,我见过的第三方软件包只能使用2.6版本.有没有人知道使用Python 2.7的Windows的第三方readline包?
为更多读者编辑:问题是我的输入文件已损坏.
我不明白我做错了什么:
我使用的是这段代码:
File f = new File("C:\\Temp\\dico.txt");
BufferedReader r = null;
try {
r = new BufferedReader(new FileReader(f));
String scan;
while((scan=r.readLine())!=null) {
if(scan.length()==0) {continue;}
//treatment
}
} catch (FileNotFoundException ex) {
Logger.getLogger(Lexique.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(Lexique.class.getName()).log(Level.SEVERE, null, ex);
} finally {
if(r!=null) try {
r.close();
} catch (IOException ex) {
Logger.getLogger(Lexique.class.getName()).log(Level.SEVERE, null, ex);
}
}
Run Code Online (Sandbox Code Playgroud)
哪个工作正常.现在,出于某种原因,我想换一台扫描仪.我的代码成了:
File f = new File("C:\\Temp\\dico.txt");
Scanner r = null;
try {
r = new Scanner(f);
String scan; …Run Code Online (Sandbox Code Playgroud) 有没有办法提前读取一行来测试下一行是否包含特定的标签数据?
我正在处理一个具有开始标记但没有结束标记的格式.
我想读一行将它添加到一个结构然后测试下面的行,以确保它不是一个新的"节点",如果它不是继续添加,如果它是关闭该结构并创建一个新的
我能想到的唯一解决方案就是让两个流读取器在同一时间沿着锁定步骤出现,但这看起来很浪费(如果它甚至可以工作)
我需要像peek但peekline这样的东西
readline ×10
bash ×2
java ×2
python ×2
vim ×2
c# ×1
command-line ×1
file ×1
gedcom ×1
keyboard ×1
libreadline ×1
mysql ×1
pdb ×1
perl ×1
python-2.7 ×1
ruby ×1
rvm ×1
streamreader ×1
ubuntu ×1
unix ×1
user-input ×1
vi ×1
windows ×1
zsh ×1