¡@

Home 

python Programming Glossary: my_script.py

How to read from stdin or from a file if no data is piped in Python?

http://stackoverflow.com/questions/2264991/how-to-read-from-stdin-or-from-a-file-if-no-data-is-piped-in-python

It should be able to read it in two ways cat data.txt . my_script.py . my_script.py data.txt A bit like grep for example. What I.. able to read it in two ways cat data.txt . my_script.py . my_script.py data.txt A bit like grep for example. What I know sys.argv and..

Use pdb.set_trace() in a script that reads stdin via a pipe

http://stackoverflow.com/questions/9178751/use-pdb-set-trace-in-a-script-that-reads-stdin-via-a-pipe

a pipe and I cannot seem to use it with pdb.set_trace . my_script.py # usr bin env python import sys import pdb def main for line.. line2 then I can run my script with cat tempfile.csv . my_script.py and everything is fine cat tempfile.csv . my_script.py Printing.. . my_script.py and everything is fine cat tempfile.csv . my_script.py Printing a line line1 Printing a line line2 On the other hand..