DOS,UNIX和标签 [英] DOS, UNIX and tabs

查看:63
本文介绍了DOS,UNIX和标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在运行正常的unix系统上有一个python脚本。我有一个运行良好的Windows系统上的python

脚本。两者都使用制表符缩进代码的
部分。我现在想在相同的系统上运行它们,实际上在同一个脚本中通过组合点块来实现
。但无论是什么

我尝试将我的Windows标签转换为空格,当我将它转移到

unix系统时,解释器会抱怨缩进样式是

在整个文件中不一致。没有通过350行

代码并手动用标签替换空格我做什么?我在想

肯定必须有一个我错过的简单解决方案!


干杯,


Ben

Hi,

I have a python script on a unix system that runs fine. I have a python
script on a windows system that runs fine. Both use tabs to indent
sections of the code. I now want to run them on the same system,
actually in the same script by combining bits and pieces. But whatever
I try my windows tabs get converted to spaces when I transfer it to the
unix system and the interpreter complains that the indentation style is
not consistent throughout the file. Short of going through 350 lines of
code and manually replacing spaces with tabs what an I do? I''m thinking
there surely must be a simple solution I have missed here!

Cheers,

Ben

推荐答案

我找到了unexpand命令,这似乎可以解决问题。但是,

它输出到标准输出,我还没有解决如何将
捕获输出到文件...


Ben


Ben写道:
I''ve found the unexpand command, which seems to do the trick. However,
it outputs to standard output, and I haven''t worked out yet how to
capture that output to a file...

Ben

Ben wrote:




我在运行正常的unix系统上有一个python脚本。我有一个运行良好的Windows系统上的python

脚本。两者都使用制表符缩进代码的
部分。我现在想在相同的系统上运行它们,实际上在同一个脚本中通过组合点块来实现
。但无论是什么

我尝试将我的Windows标签转换为空格,当我将它转移到

unix系统时,解释器会抱怨缩进样式是

在整个文件中不一致。没有通过350行

代码并手动用标签替换空格我做什么?我在想

肯定必须有一个我错过的简单解决方案!


干杯,


Ben
Hi,

I have a python script on a unix system that runs fine. I have a python
script on a windows system that runs fine. Both use tabs to indent
sections of the code. I now want to run them on the same system,
actually in the same script by combining bits and pieces. But whatever
I try my windows tabs get converted to spaces when I transfer it to the
unix system and the interpreter complains that the indentation style is
not consistent throughout the file. Short of going through 350 lines of
code and manually replacing spaces with tabs what an I do? I''m thinking
there surely must be a simple solution I have missed here!

Cheers,

Ben


2006-12-27,Ben< Be ************* @ gmail.comwrote:
On 2006-12-27, Ben <Be*************@gmail.comwrote:

我找到了unexpand命令,这似乎可以解决问题。但是,

它输出到标准输出,我还没有解决如何将
捕获输出到文件...
I''ve found the unexpand command, which seems to do the trick. However,
it outputs to standard output, and I haven''t worked out yet how to
capture that output to a file...



unexpand< file1> file2


-

Grant Edwards grante哇!你看!! SIZE 9 CAPRI裤子一双

!!他们

visi.com可能属于SAMMY

DAVIS,JR。!!

unexpand <file1 >file2

--
Grant Edwards grante Yow! Hey, LOOK!! A pair of
at SIZE 9 CAPRI PANTS!! They
visi.com probably belong to SAMMY
DAVIS, JR.!!


很棒 - 很有效。谢谢!

这是linux中的一般方法你总是可以用来将

标准输出重定向到一个文件吗?


干杯,


Ben

Grant Edwards写道:
Great - that worked.Thanks!
Is that a general method in linux you can always use to redirect
standard output to a file?

Cheers,

Ben
Grant Edwards wrote:

2006-12-27,Ben <是************* @ gmail.comwrote:
On 2006-12-27, Ben <Be*************@gmail.comwrote:

我找到了unexpand命令,这似乎做了诀窍。但是,

它输出到标准输出,我还没有解决如何将
捕获输出到文件...
I''ve found the unexpand command, which seems to do the trick. However,
it outputs to standard output, and I haven''t worked out yet how to
capture that output to a file...



unexpand< file1> file2


-

Grant Edwards grante哇!你看!! SIZE 9 CAPRI裤子一双

!!他们

visi.com可能属于SAMMY

DAVIS,JR。!!


unexpand <file1 >file2

--
Grant Edwards grante Yow! Hey, LOOK!! A pair of
at SIZE 9 CAPRI PANTS!! They
visi.com probably belong to SAMMY
DAVIS, JR.!!


这篇关于DOS,UNIX和标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆