0

i'm new in python and regex, i have a string like this:

articulo = "["{"id":2997,"name":"ACEITE CA\u00d1UELAS GIRASOL 1.5L","description":" ACEITE CA\u00d1UELAS GIRASOL 1.5L <\/h1>\n SKU: <\/strong>108953\n EAN: <\/strong>7792180001665","metaDescription":null,"category":{},"slug":"aceite-canuelas-girasol-1-5l-1","sku":"108953","new":false,"consultation":false,"hasVariations":false,"variations":[],"hasGallery":true,"gallery":[{"id":2997,"gallery":[{"order":0,"id":2997}],"type":"product_image"}],"breadcrumb":[{"onDestroy":null}],"categoryPath":"Almac\u00e9n","additionalInfo":[],"documents":[],"minSellingPrice":"326.2000","maxSellingPrice":"326.2000","totalNetStock":99954,"availability":"in stock","brand":{"id":294,"name":"CA\u00d1UELAS","hasImage":false},"price":326.2,"discountedPrice":null,"stock":99954}"]"

And i'm looking for to replace unicode codes to latin character, for example CA\u00d1UELAS must be "CAÑUELAS". I haven found a function to do this, so i'm looking for get to this using regular expression.

Any one can help me solve this?

Cheers, Santy

santys
  • 1
  • 2
  • To start with... What version of python are you using? String handling has changed considerably over the years. Next up... Why are you trying to solve this with a regex? Python has countless functions for manipulating string encodings and converting back/forth. I'd suggest you start reading here: https://docs.python.org/3/howto/unicode.html – Basic Sep 24 '21 at 16:09
  • \u00d1 *is* Ñ - you need to either encode the string to a character class, or look at what is consuming this string and not displaying it with the appropriate character set. – match Sep 24 '21 at 16:19
  • Hi! i'm using Python 3.9.7. Right no i ill check your link. Thanks – santys Sep 24 '21 at 16:21
  • @match i'm trying to scrape a url to recovery changes on prices. Im using beautufulsoup – santys Sep 24 '21 at 16:31
  • This do the trick: [link]https://stackoverflow.com/questions/1207457/convert-a-unicode-string-to-a-string-in-python-containing-extra-symbols – santys Sep 24 '21 at 16:38

0 Answers0