Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 11th, 2012  |  syntax: None  |  size: 0.40 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Python regex- match a string like MGRoad to a sting like MG_Road
  2. www.abc.com/category-city_area_name-deal/
  3.  
  4. city=[AreaName]
  5.        
  6. url = "www.abc.com/category-city_area_name-deal/"
  7. city = "AreaName"
  8.  
  9. if city.replace('_', '').lower() in url.replace('_', '').lower():
  10.     print 'ok'
  11.        
  12. city.replace('_', '').lower() -> 'areaname'
  13.  url.replace('_', '').lower()  -> 'www.abc.com/category-cityareaname-deal/'