Reputation: 1031
C code:
write(3, "str", sizeof("str") - 1);
Usage: ./a.out 3>/dev/stdout
How to achieve the same functionality in Python? From documentation I should call open function and use given file descriptor. But what if I already have it?
Upvotes: 1
Views: 486
Reputation: 1372
You should be able to do something similar in python. See this SO answer for a more detailed description.
It'll look something like:
yourfd = open(3, "w")
yourfd.write("str")
yourfd.close()
Upvotes: 1