How to read the last line of a file in Python?

I have a two requirements .

First Requirement-I want to read the last line of a file and assign the last value to a variable in python.

Second Requirement

Here is my sample file.

<serviceNameame="demo" wsdlUrl="demo.wsdl" serviceName="demo"/>
<context:property-placeholder location="filename.txt"/>

From this file I want to read the content i.e filename.txt which will be after <context:property-placeholder location= ..And want to assign that value to a variable in python.

Leave a Comment