0

I would like to extract a money value when using IMDbPY to extract datas from IMDB.

My problem is that IMDbPY returns results in the following format, what is a unicode string:

In : movie['business']['gross'][0]
Out: u'$134,966,411 (USA) (11 May 1997)'

Also, the date is sometimes present, sometimes not.

Can you help me how to extract the number from this string, without accidentally recognising the date/year part?

The currency symbol and the country code are not important.

hyperknot
  • 13,454
  • 24
  • 98
  • 153

1 Answers1

0

re.match with this pattern:

r"\$([1-9][0-9,]+)"
Fred Foo
  • 355,277
  • 75
  • 744
  • 836