This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VOWELS = ['a', 'e', 'i', 'o', 'u',] | |
def syllables(word): | |
''' Really basic syllable counter ''' | |
num = 0 | |
previously_vowel = False | |
for char in word: | |
if char in VOWELS: | |
if not previously_vowel: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.techbeamers.com/python-tutorial-write-tcp-server/ | |
import socketserver | |
class Handler_TCPServer(socketserver.BaseRequestHandler): | |
def handle(self): | |
# self.request - TCP socket connected to the client | |
self.data = self.request.recv(1024).strip() | |
print("{} sent:".format(self.client_address[0])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.techbeamers.com/python-tutorial-write-tcp-server/ | |
import socket | |
host_ip, server_port = "127.0.0.1", 9999 | |
data = "Hello how are you?\n" | |
# Initialize a TCP client socket using SOCK_STREAM | |
tcp_client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
try: |