Human: Write me a Python function for string extract title titanic. Assistant: 
Here is a Python function for string extract title titanic

import string

def extract_title(s):
    """
    Extract title from a string.
    :param s: (str)
    :return: (str)
    """
    return s.split(' ')[0]

# Enter the string
string = "This is a title with a space."

# Calling the function
title = extract_title(string)

# Printing the result
print(title)

#Example Output
# This

#Remember to inspect code for bugs.