有道词典 python
def youdaocidian(): danciben_path=r"C:\Users\wx\Desktop\123.txt" with open(danciben_path,encoding='utf-8') as f: file=f.read() each=random.choice(file.split('</item>')) #print(each) x=(each[each.find('<word>'):each.find(']]></trans')]) cd=x.replace('<word>','').replace('<trans><![CDATA[','') eng=cd.split('</word>')[0] chn=cd.split('</word>')[1].strip() return eng +'\n'+chn
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号