Skip to content

Instantly share code, notes, and snippets.

@phanthaihuan
Created May 13, 2020 14:15
Show Gist options
  • Save phanthaihuan/fd35435a37d1980fd1c8eff0d6cabbce to your computer and use it in GitHub Desktop.
Save phanthaihuan/fd35435a37d1980fd1c8eff0d6cabbce to your computer and use it in GitHub Desktop.
How to read file in Python
#!/usr/bin/env python
import os
PWD = os.getcwd()
my_file = os.path.join(PWD, 'data.txt')
with open(my_file) as f:
for line in f:
print(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment