How to get "clean" match results in Python
Question: I am a total noob, coding for the first time and trying to learn by doing. I'm
using this:

    
    
    import re
    f = open('aaa.txt', 'r')
    string=f.read()
    c = re.findall(r"Guest last name: (.*)", string)
    print "Dear Mr.", c
    

that returns

    
    
    Dear Mr. ['XXXX']
    

I was wondering, is there any way to get the result like

    
    
    Dear Mr. XXXX
    

instead?

Thanks in advance.


Answer: You need to take the first item in the list

    
    
    print "Dear Mr.", c[0]
    

