Python: How do i split the file?
<p>I have this txt file which is ls -R of etc directory in a linux system. Example file:  </p>

<pre><code>etc:  
ArchiveSEL  
xinetd.d

etc/cmm:  
CMM_5085.bin  
cmm_sel  
storage.cfg  

etc/crontabs:  
root

etc/pam.d:  
ftp    
rsh  

etc/rc.d:  
eth.set.sh  
rc.sysinit  

etc/rc.d/init.d:  
cmm  
functions  
userScripts  

etc/security:  
access.conf  
console.apps  
time.conf

etc/security/console.apps:  
kbdrate

etc/ssh:  
ssh_host_dsa_key  
sshd_config  

etc/var:  
setUser  
snmpd.conf

etc/xinetd.d:  
irsh  
wu-ftpd
</code></pre>

<p>I would like to split it by subdirectories into several files. example files would be like this:  etc.txt, etcCmm.txt, etcCrontabs.txt, etcPamd.txt, ...<br>
Can someone give me a python code that can do that?
Notice that the subdirectory lines end with ':', but i'm just not smart enough to write the code. some examples would be appreciated. 
thank you :)</p>
