Skip to content
Snippets Groups Projects
Commit 769bfcba authored by Christopher 'horni' Hornberger's avatar Christopher 'horni' Hornberger
Browse files

first commit

parents
Branches master
Tags v0.01
No related merge requests found
README 0 → 100644
* first python scripts I wrote
* maybe it's useful for learning
#!/usr/bin/python
import sys
datei = open(sys.argv[0],"rU")
for zeile in datei:
print zeile,
datei.close()
sys.exit(0)
#!/usr/bin/python
import sys
import socket
if len(sys.argv) > 1:
host = sys.argv[1]
port = int(sys.argv[2])
else:
print "usage: ", sys.argv[0], "host port"
sys.exit(0)
sock = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host,port))
text = sys.stdin.readline()
while text:
write = sock.send(text)
text = sys.stdin.readline()
sys.exit(0)
hello.py 0 → 100755
#!/usr/bin/python
import sys
if len(sys.argv) > 1:
for name in sys.argv[1:]:
print "Hi", name
else:
print "Hi Christopher"
#!/usr/bin/python
import sys
import socket
if len(sys.argv) > 1:
host = sys.argv[1]
port = int(sys.argv[2])
else:
print "usage: ", sys.argv[0], "host port"
sys.exit(0)
sock = socket.socket(
socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host,port))
datei = open(sys.argv[0],"rU")
for zeile in datei:
write = sock.send(zeile)
datei.close()
sys.exit(0)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment