How can I treat double quoted data and single quoted data same in Python 2.x? -


i have hardcoded metadata file data wrapped around in single quotes 'australia', 'usa'. metadata compared against new data can wrapped in either double quotes "usa" (problem in comparing), or singles quotes (where have no problem) . also, cannot compare 'usa' against "usa" .since new files large ~ 700 mb , don't want performance intensive replacement of data using replace function . how can compare metadata new data ?

if want use @jay's algorithm, without imports, may like:

def make_str(s):     return s.strip("'").strip('"')  = 'usa' b = '"usa"'  c = "un" d = "'un'"   if make_str(a) == make_str(b):      print(make_str(a))  if make_str(c) == make_str(d):      print(make_str(c)) 

Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -