File tree 2 files changed +33
-7
lines changed
2 files changed +33
-7
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ # coding: utf-8
2
+
3
+ def main (args ):
4
+ if len (args ) > 3 :
5
+ script_name , input_file_name , output_file_name = args
6
+ else :
7
+ input_file_name , output_file_name = "input.txt" , "output.txt"
8
+ input_file = open (input_file_name )
9
+ output_file = open (output_file_name , 'w' )
10
+
11
+ string = "1 2 3 4 5 6 7 8 9 10"
12
+ encoded_content = ""
13
+
14
+ for line in input_file :
15
+ for i in range (len (line )):
16
+ if ord (line [i ]) > 191 and ord (line [i ]) < 256 :
17
+ offset = 0 ;
18
+ if line [i ].islower ():
19
+ offset = 32
20
+ if ord (line [i ]) + int (string .split (' ' )[i % len (string .split (' ' ))]) > 223 + offset :
21
+ encoded_content += chr (191 + offset + (ord (line [i ]) + int (string .split (' ' )[i % len (string .split (' ' ))]))% (223 + offset ))
22
+ else :
23
+ encoded_content += chr (ord (line [i ]) + int (string .split (' ' )[i % len (string .split (' ' ))]))
24
+ else :
25
+ encoded_content += line [i ]
26
+ output_file .write (encoded_content )
27
+ input_file .close ()
28
+ output_file .close ()
29
+
30
+
31
+ if __name__ == '__main__' :
32
+ from sys import argv
33
+ main (argv )
You can’t perform that action at this time.
0 commit comments