Python Oneliner Program
Jump to navigation
Jump to search
A Python Oneliner Program is a oneliner program that is a Python program.
- Example(s):
python -c 'print("Hello, World!")'
python -c "import sys;[sys.stdout.write(' '.join(line.split(' ')[2:])) for line in sys.stdin]" < input.txt
- Counter-Example(s):
- See: Python Code, Python Program Template.
Notes
coding examples of Python Oneliner Programs.
- wrap each line with <s> … </s>
% python -c 'print “<s>$_<\/s>"' < file.txt
References
2012
- http://wiki.python.org/moin/Powerful%20Python%20One-Liners
- Reimplement cut: Print every line from an input file but remove the first two fields.
python -c "import sys;[sys.stdout.write(' '.join(line.split(' ')[2:])) for line in sys.stdin]" < input.txt
- Reimplement cut: Print every line from an input file but remove the first two fields.