所以我有一个由一列组成的文本文件,每列包含两个数字
190..255
337..2799
2801..3733
3734..5020
5234..5530
5683..6459
8238..9191
9306..9893我想丢弃第一个也是最后一个数字,在本例中是190和9893。基本上把剩下的数字前移一位。像这样
我想要的输出
255..337
2799..2801
3733..3734
5020..5234
5530..5683
6459..8238
9191..9306我希望这能说得通我不知道该怎么做
发布于 2013-03-07 13:18:58
temp = []
with open('temp.txt') as ofile:
for x in ofile:
temp.append(x.rstrip("\n"))
for x in range(0, len(temp) - 1):
print temp[x].split("..")[1] +".."+ temp[x+1].split("..")[0]
x += 1https://stackoverflow.com/questions/15263158
复制相似问题