Python UnicodeDecodeError exception
Question: 
    txt = input("vilken textfil vill du använda?")
    fil = open(txt,"r")
    
    spelare=[]
    resultat=[]
    bästnamn=None
    bästkast=0
    
    for line in fil:
    
    kolumn=line.split()
    kolumn1=len(kolumn[1])
    kolumn2=len(kolumn[2])
    if len(kolumn)<5:
        mu=float(kolumn[1])
        sigma=float(kolumn[2])
        #print(mu,sigma)
        #kast=random.normalvariate(mu,sigma)
        #print(kast)
    
        for r in range(0,6):
            kast=random.normalvariate(mu,sigma)
            resultat.append(kast)
    
    if max(resultat)>bästkast:
       bästkast=max(resultat)
       bästnamn=kolumn[0]
    
    print("Segrare", bästnamn, "som stötte", bästkast, "meter")
    

When I running the program I get this error:

    
    
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 85: ordinal not in range(128)
    

What am I doing wrong?

Thank you so much and yes I have python 3. With the change as you sad to
import the codecs, I now get another error insteed.

`ValueError: max() arg is an empty sequence`

What sholud I do? any suggestions?


Answer: As far as i know, you have to type English letters in order python be able to
read it. so you need to change these variables:

    
    
    bästnamn
    bästkast
    

**Edit:** `max()` is to give a maximum of a list and in string case it will
break it to letters and give you back the maximum letter in alphabet, like so:

    
    
    myNumList = [1,2,4,5,8,50,10]`
    print max(myNumList ) #result 50
    
    myString = 'tree'
    print max(myList) #result 't' 
    
    myMixList = [1,2,4,'Apple','20']`
    print max(myMixList) #result 'Apple' 
    

**Note** it wont work on single `integer` you will get error, but you do have
pass list to it.

your code is fine, just the document you are feeding to, might has some
mistakes init, I see your application expect at least 4 column but never use
the 4th column which the file type of it doesn't really matter, but i believe
your document should be like so:

    
    
    [String/number] [Number] [Number]
    

example of your document should be like so:

    
    
    String1 158 212
    String2 584 795
    1234567 845 356
    String4 356 489
    String5 876 215
    String6 985 853
    String7 111 809
    String8 234 058 
    

**Note:** if you have string in second or third column that could cause the
error, string can't convert to `float` as well as `random.normalvariate` wont
take string.

