Skip to content

Instantly share code, notes, and snippets.

@sean0921
Last active November 30, 2019 13:27
Show Gist options
  • Save sean0921/28e32e6ab9aa85596b1176b21c229e4f to your computer and use it in GitHub Desktop.
Save sean0921/28e32e6ab9aa85596b1176b21c229e4f to your computer and use it in GitHub Desktop.
test for loop in py3
c
123
f
456
i
789
#!/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=' ') ) )
a b c
d e f
g h i
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