in c / c++ i use EOF like
int n;
while( scanf("%d",&n) != EOF ){
printf("%d",n);
}
now how can i use EOF in Python ?
please give me the same code using python
in c / c++ i use EOF like
int n;
while( scanf("%d",&n) != EOF ){
printf("%d",n);
}
please give me the same code using python
You would do something like this in python:
with open(filename, 'r') as f:
for line in f:
print(line)