Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1051633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:57:56+00:00 2026-05-16T16:57:56+00:00

I am making a inverted index using hadoop and python. I want to know

  • 0

I am making a inverted index using hadoop and python.
I want to know how can I include the byte offset of a line/word in python.
I need something like this

hello hello.txt@1124

I need the locations for making a full inverted index.
Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T16:57:56+00:00Added an answer on May 16, 2026 at 4:57 pm

    Like this?

    file.tell()
    

    Return the file’s current position, like stdio’s ftell().

    http://docs.python.org/library/stdtypes.html#file-objects

    Unfortunately tell() does not function since OP is using stdin instead of a file. But it is not hard to build a wrapper around it to give what you need.

    class file_with_pos(object):
        def __init__(self, fp):
            self.fp = fp
            self.pos = 0
        def read(self, *args):
            data = self.fp.read(*args)
            self.pos += len(data)
            return data
        def tell(self):
            return self.pos
    

    Then you can use this instead:

    fp = file_with_pos(sys.stdin)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 532k
  • Answers 532k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Looks like a missing jar file, containing the class "com.mmz.mvc.test.AgentDAOTest".… May 17, 2026 at 12:09 am
  • Editorial Team
    Editorial Team added an answer I decided to take another route. While I had read… May 17, 2026 at 12:09 am
  • Editorial Team
    Editorial Team added an answer JSON is a data-interchange format. GSON is a Google library… May 17, 2026 at 12:09 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am making a db schema for facebook like wall structure. I need to
I'm making my own string class and I'd like to ensure that CString a
When I enter an object into the DB with Linq-to-SQL can I get the
While making an access database, I'd like to make it as idiot proof as
I am making changes to a jQuery validator, when there is an error it
I'm making a little app for calculating tips for Windows Phone 7 and I
I am using Microsoft Visual Studio Professional 2010. (Also SQL Management Studio for my
I want to be able to create users that have a straight up SHA-1
I an a graduate student of nuclear physics currently working on a data analysis
I have a stored procedure that is working with a large amount of data.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.