1:www.jb51.net
2:www.jb51.net
3:www.jb51.net
example: 4:www.jb51.net
5:www.jb51.net
6:www.jb51.net
7:www.jb51.net
8:www.jb51.net
9:www.jb51.net
10:www.jb51.net
11:www.jb51.net
12: http://www.jb51.net
13:www.jb51.net
14:www.jb51.net
15:www.jb51.net
16:www.jb51.net

python

 coding: -*- # function code UTF-8 -*- 'Python read the file, even for an output file, the odd rows output a file' def fenhang (infile, outfile, outfile1): infopen = open (infile,'r', encoding='utf-8') OUTOPEN = open (outfile,'w', encoding='utf-8') outopen1 = open (outfile1,'w', encoding='utf-8') lines = infopen.readlines (I) = 0 for line in lines: I I = 1 F I% 2 = = 0: (line) outopen.write else: outopen1.write (line) infopen.close (outopen.close) (fenhang) ("jb51.txt", "oushu.txt", "jishu.txt") 

renderings

"src=" //files.jb51.net/file_images/ article/201803/201803192015442.png ">

python

% of what the modulo operation, the equivalent of mod, the remainder of a division is also calculated, such as 5%3 2.


This concludes the body part

This paper fixed link:http://www.script-home.com/python-odd-and-even-rows-separate-the-implementation-code.html | Script Home | +Copy Link

Article reprint please specify:Python odd and even rows separate the implementation code | Script Home

You may also be interested in these articles!