Q:

weird text concatenation

I get weird output when I concatenate. 
When it use this: 
print 'sadasdadgdsfdajfhdsgsdkjhgsfjhdfdsfds'+'.323232600656520346403'

it works fine. 
but when i do this:
getReference = open('test.txt','r')

for line in getReference:#os.path.exists(''+line+'.txt')

    try:
        with open(''+line+'.txt') as f: pass
    except IOError as e:
        newURL ='http://www.intrat.th/'+''.join(line)+'.fsta'
        print newURL

When I print newURL it doesn't give me one line text but instead it has .fsta on the second line. 
why is this happen?  

A:

This is because line is terminated with a '\n', a newline character. 
One way of fixing this is:
for line in getReference:
    line = line.strip()
    # more code manipulating line
    # print stuff

A:

your line:
for line in getReference:

will iterate over lines in the file, including the newline character(s) \n (and \r). 
Therefore, you are probably trying to open a file 'filename\n.txt', which is not what you mean to do. 
As as solution, use strip:
with open(''+line.strip()+'.txt') as f: pass

