Skip to content

dante-biase/python-tee

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-tee

python-tee is a simple tool that allows you to simultaneously print output to console and a variable number of files.

features

  • zero dependencies
  • object oriented and functional implementations
  • same function signature as standard print function
  • write and append file modes

requirements

  • Python >= 3.6

install

$ pip3 install python-tee

examples

OOP

from tee import Tee

tee = Tee("output1.log", "output2.log", mode='w')

tee("Hello", "World", sep=', ', end='!')
# >>> Hello, World!
tee()
# >>> ''
tee(1, 2, 3, ['a', 'b', 'c'])
# >>> 1 2 3 ['a', 'b', 'c']
# output1.log, output2.log
Hello, World!
1  2  3 ['a', 'b', 'c']

Functional

from tee import tee

tee("Hello", "World", sep=", ", end="!", files=["output1.log", "output2.log"], mode='w')
# >>> Hello, World!
# output1.log, output2.log
Hello, World!

About

python-tee is a simple tool that allows you to simultaneously print output to console and a variable number of files

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages