Last active
November 30, 2019 13:27
-
-
Save sean0921/28e32e6ab9aa85596b1176b21c229e4f to your computer and use it in GitHub Desktop.
test for loop in py3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c | |
123 | |
f | |
456 | |
i | |
789 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
f = open("./test1.txt") | |
content_f = f.read() | |
g = open("./test2.txt") | |
content_g = g.read() | |
lines_f = content_f.split(sep='\n') | |
lines_g = content_g.split(sep='\n') | |
for i in range(3): | |
print(lines_f[i].split(sep=' ')[2]) | |
print( ''.join( str(j) for j in lines_g[i].split(sep=' ') ) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a b c | |
d e f | |
g h i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 2 3 | |
4 5 6 | |
7 8 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment