#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt" , "w" , stdout);
#endif
Is there anything in python like this. If python has something of this type can you guide me how to use it?
# | User | Rating |
---|---|---|
1 | tourist | 3671 |
2 | jiangly | 3653 |
3 | Um_nik | 3629 |
4 | Benq | 3513 |
5 | ksun48 | 3486 |
6 | MiracleFaFa | 3466 |
7 | slime | 3452 |
8 | maroonrk | 3422 |
9 | Radewoosh | 3406 |
10 | greenheadstrange | 3393 |
# | User | Contrib. |
---|---|---|
1 | awoo | 188 |
2 | -is-this-fft- | 185 |
3 | YouKn0wWho | 182 |
4 | Um_nik | 180 |
5 | Monogon | 178 |
6 | antontrygubO_o | 171 |
7 | maroonrk | 165 |
8 | SlavicG | 163 |
8 | adamant | 163 |
8 | SecondThread | 163 |
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt" , "w" , stdout);
#endif
Is there anything in python like this. If python has something of this type can you guide me how to use it?
Name |
---|
.
.
check this blog
I have seen this blog but this is not working
in python we don't have these lines its present only in Cpp see this link
import sys
sys.stdin = open('input.txt', 'r')
sys.stdout = open('output.txt', 'w')
this works for me
I think this is the intended way to do it in Python. Using this you can just use
print()
andinput()
as normal.Btw, if you want to go back to using stdin/stdout again, you can just do