0

I have a .rar file say for example English-Lexicon.rar Inside this .rar file, are two .txt files, i.e neg.txt and pos.txt. I need to access the contents inside the neg.txt and pos.txt using python. How can this be done? I'm fairly new to python.

user1452759
  • 8,810
  • 15
  • 42
  • 58
  • Reading rar files from Python is a little tricky. See this answer: http://stackoverflow.com/questions/1185959/read-content-of-rar-file-into-memory-in-python/1186041#1186041 – Shawn Chin Jul 16 '12 at 09:43

1 Answers1

0

Haven't used it, but google came up with rarfile.

Ethan Furman
  • 63,992
  • 20
  • 159
  • 237
  • I did install rarfile but I have no clue as to how to use this. And there isn't a documentation for it either. – user1452759 Jul 16 '12 at 10:18
  • @user1452759: The blurb on the front page says, `The interface is made as zipfile like as possible.` Check out the [`Zipfile` docs](http://docs.python.org/library/zipfile.html). – Ethan Furman Jul 16 '12 at 13:04
  • The doc is located at https://rarfile.readthedocs.io/en/latest/api.html . And the reading speed is very slow compare to a direct read from file uncompressed file. – Steven Du May 30 '16 at 09:09