python第三天 文件的操作习题
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python第三天 文件的操作习题相关的知识,希望对你有一定的参考价值。
文件内容如下:以tomcat的server.xml文件为例
1.查找 Server下有多少个<Listener>节点,并打印出来
2.在文件我末尾增加一个
<Service>
<Host name="127.0.0.1" appBase="java"
unpackWARs="false" autoDeploy="false">
</Service>,要求这个service 在server里面
3.修改,讲增加的那个service里面的
unpackWARs="false" autoDeploy="false" 改为
unpackWARs="true" autoDeploy="true"
4.删除自己增加的那部分内容
<?xml version=‘1.0‘ encoding=‘utf-8‘?> <Server port="8085" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --> <Listener className="org.apache.catalina.core.JasperListener" /> <!-- Prevent memory leaks due to use of particular java/javax APIs--> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /> <GlobalNamingResources> <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> </GlobalNamingResources> <Service name="Catalina"> <Connector port="8099" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> <Connector port="8089" protocol="AJP/1.3" redirectPort="8443" /> <Engine name="Catalina" defaultHost="localhost"> <Realm className="org.apache.catalina.realm.LockOutRealm"> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/> </Realm> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" resolveHosts="false"/> </Host> </Engine> </Service> </Server>
以上是关于python第三天 文件的操作习题的主要内容,如果未能解决你的问题,请参考以下文章