Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 从文本文件中提取字符_Python_File_Text_Encryption - Fatal编程技术网

Python 从文本文件中提取字符

Python 从文本文件中提取字符,python,file,text,encryption,Python,File,Text,Encryption,我有一个文本文件,其中说明: The quick brown fox jumps over the lazy dog. 我想提取从零开始的偶数位置的字符,并从中创建一个字符串,如string_even=Teqikbonfxjmsoe h aydg 以及位于奇数位置的字符,如string_odd=h uc rw o up vrtelz o. 我只是在学习如何读取文本文件,不知道如何解决这个问题这与加密有什么关系?我正在编写的程序基于使用算法转置密码,我将解密和加密文本文件 print txt[0

我有一个文本文件,其中说明:

The quick brown fox jumps over the lazy dog.
我想提取从零开始的偶数位置的字符,并从中创建一个字符串,如string_even=
Teqikbonfxjmsoe h aydg

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


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

这与加密有什么关系?我正在编写的程序基于使用算法转置密码,我将解密和加密文本文件
print txt[0::2]
print txt[1::2]