Closed. This question needs details or clarity。它当前不接受答案。
                            
                        
                    
                
                            
                                
                
                        
                            
                        
                    
                        
                            想改善这个问题吗?添加详细信息并通过editing this post阐明问题。
                        
                        5年前关闭。
                                                                                            
                
        
我无法在以下代码中拆分Unicode字符\ u2013

actualdata=metatry['content'].split("-")
print "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"+actualdata[0]
dat=actualdata[0].split("\u2013")
print "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"+dat[0]
productlist.append(dat[0])


即使当前输出也不会摆脱\ u2013
如果有人对此有所帮助,将会有所帮助。

最佳答案

尝试将'u'添加到'\u2013'中,因为metatry['content']是unicode字符串:

u"Samsung Galaxy Note II \u2013 Latest Smartphone in India ".split(u'\u2013')

07-26 01:29