给定一个英文文本，编写一个Python函数，计算其中每个单词的字符数，然后输出平均字符数。


input_text = "This is a sample text."
```python
def average_word_length(text):
    words = text.split()
    total_chars = sum(len(word) for word in words)
    return total_chars / len(words)

input_text = "This is a sample text."
print(average_word_length(input_text))
```

Output: 4.0