threads instead od processes

Markus Franz mail at markus-franz.de
Fri Jul 2 17:28:20 CEST 2004


Hi.

I've got a little script:

#!/usr/bin/python
import sys, os
for x in sys.argv[1:]:
    pid = os.fork()
    if pid == 0:
        # do something with x
        break

This creates some new processes (depending on the number of passed command
line arguments) and inside each process x is one command line argument.

Now my question is: How can I do the same by using threads instead of
processes?
Thank you.


Best regards

Markus Franz





More information about the Python-list mailing list