fork(1) download
  1. #!/usr/bin/python3
  2.  
  3.  
  4. import re
  5. import sys
  6. import json
  7. import tempfile
  8.  
  9. cursor = """
  10. bgp_path 15970839
  11. sys_calls 3189266
  12. regs 2802296
  13. sys_users 2463881
  14. routes 1253487
  15. current 879094
  16. """
  17.  
  18. with tempfile.NamedTemporaryFile() as fp:
  19. fp.seek(0)
  20.  
  21. for line in cursor.splitlines():
  22. if len(line) == 0: continue
  23. tmp = "some.str {0}".format(line)
  24. fp.write(tmp.encode('utf-8'))
  25.  
  26. fp.flush()
  27. print(fp.read())
  28.  
Success #stdin #stdout 0.06s 13168KB
stdin
Standard input is empty
stdout
b''