Longest word in a txt file python code?
<p>This is my version of this program. Is there a shorter and simpler way to do this?</p>

<pre><code>d = open('txt.txt','r')
l = d.readlines()
string = l[0]
stringsplit = string.split()

d = []
for i in stringsplit:
    d.append(len(i))
    e = max(d)
for j in stringsplit:
    if len(j) == e:
        print("The longest word is", j, "and it is", len(j),"characters long")
</code></pre>