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 8271967
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:59:02+00:00 2026-06-08T06:59:02+00:00

This is copy of the code in mining the social web book. I am

  • 0

This is copy of the code in mining the social web book.

I am a new in this field and with redis too. I want to understand what does $ mean in this context. Also the print with %s, What does it mean?

This is the source code below (from: https://github.com/ptwobrussell/Mining-the-Social-Web):

import sys
import redis

from twitter__util import getRedisIdByScreenName

# A pretty-print function for numbers
from twitter__util import pp

r = redis.Redis()
screen_names=['user1','user2']
def friendsFollowersInCommon(screen_names):
    r.sinterstore('temp$friends_in_common',
        [getRedisIdByScreenName(screen_name, 'friend_ids')
         for screen_name in screen_names]
    )

r.sinterstore('temp$followers_in_common',
    [getRedisIdByScreenName(screen_name, 'follower_ids')
     for screen_name in screen_names]
)

print 'Friends in common for %s: %s' % (', '.join(screen_names),
                                        pp(r.scard('temp$friends_in_common')))

print 'Followers in common for %s: %s' % (', '.join(screen_names),
                                          pp(r.scard('temp$followers_in_common')))

# Clean up scratch workspace

r.delete('temp$friends_in_common')
r.delete('temp$followers_in_common')

if __name__ == "__main__":
    if len(screen_names) < 2:
        print >> sys.stderr, "Please supply at least two screen names."
        sys.exit(1)

friendsFollowersInCommon(screen_names[1:])
  • 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-06-08T06:59:03+00:00Added an answer on June 8, 2026 at 6:59 am

    $ symbol is just a part of key name. It separates name parts. I usually use : for the same purpose (e.g. users:123)

    %s part is python‘s string formatting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just copy this code from perl cook book 2nd ed pp. 796 it returns:
I copy this code from a book. In every comment I put a number
This loop works fine in Main function but when copy this loop code in
While I'm reading boost/shared_ptr.hpp, i saw this code: // generated copy constructor, destructor are
I all, I just follow this great example: http://qt-project.org/doc/qt-4.8/tools-customcompleter.html I copy the code exactly
This is my code to copy files in a list from source to destination.
I copy and paste code from this URL for creating and reading/writing a proc
I've copy/pasted the code from this tutorial about sockets on Android . It builds
I'm trying to copy a QList in a std::vector this is my code: std::copy(_param_31.listJobs->list_USCOREjobs.begin(),
I copy-pasted from MSDN this code: using System.Security.Cryptography; byte[] buffer = enc.GetBytes(text); SHA1CryptoServiceProvider cryptoTransformSHA1

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.