input = open("ex3.txt")
DNA = input.read()
DNA2 = "AAAACCCGGT"
print "string=", DNA,"len=", len(DNA)
print "strin2=",DNA2,"len=",len(DNA2)
returns
>string= AAAACCCGGT
>len= 11
>strin2= AAAACCCGGT len= 10
As you can see, the two strings which appear identical have different lengths because when I load the input using input.read() the string ends in Nonetype (edit: actually ends in '\n')
Is there a way to load string input from a textfile without it ending in Nonetype? Or should I just load as is and splice the input like DNA[:-1] assuming .read() will always have Nonetype as the final value?
Thanks for any tips :-D
Edit: I supposed the reason I was confused about Nonetype is because of the error message: "TypeError: cannot concatenate 'str' and 'NoneType' objects" Anyways, calling .rstrip worked great thanks again everyone