1

我有一个文本文件,其中指出:

The quick brown fox jumps over the lazy dog.

我想从零开始提取偶数位置的字符并从中创建一个字符串,如 string_even =Teqikbonfxjmsoe h aydg

以及奇数位置的字符,例如 string_odd =h uc rw o up vrtelz o.

我只是在学习如何阅读文本文件,不知道如何解决这个问题

4

1 回答 1

3
print txt[0::2]
print txt[1::2]
于 2013-10-27T23:50:23.000 回答