I am trying print the contents of a text file using below code,the text file will only contain one line,my current output is as below which is a list with "\r\n" at the end,I want to the output to be as shown in "EXPECTED OUTPUT" ?
branch_textfile = branch + '.txt'
with open(branch_textfile, 'r') as f: #open the file
contents = f.readlines() #put the lines to a variable (list).
#contents = contents.rstrip()
print contents
CURRENT OUTPUT:-
['AU_TEST_PUBLIC_BRANCH.05.01.01.151.005\r\n']
EXPECTED OUTPUT:-
AU_TEST_PUBLIC_BRANCH.05.01.01.151.005
readlines()- it's not the right method for the job here.