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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:08:01+00:00 2026-06-10T22:08:01+00:00

using python i create a hash result for a file. i retrieve a hash

  • 0

using python i create a hash result for a file. i retrieve a hash result from somewhere else, but i have to retrieve it using stdout, and i would like to compare the two. however the retrieved stdout is retrieved as a list, and has a \n at the end. if i print it it might look, for example, like this: [6d52f\n]

i know that the problem is that if i try to add the \n to my current hash result, it automatically disregards the \n to try to compare the two (like i do below in my code), so i’m currently a bit unsure about how i can compare the two. i know the answer is probably staring me in the face, but i would appreciate any help.

my code is:

if ("%s\n" % thishash == otherhash):
    print "they are the same"
else:
    print "they are not the same"
  • 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-10T22:08:03+00:00Added an answer on June 10, 2026 at 10:08 pm

    Simply strip the newline from the stdin:

    >>> x = ['6d52f\n']
    >>> x[0].rstrip('\n')
    '6d52f'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Python's Imaging Library I want to create a PNG file. I would like
I try using python create filter for log file like Thu Oct 4 23:14:40
I'd like to create a Word document using Python, however, I want to re-use
I'm trying to create an xml entry that looks like this using python and
I'm trying to create a GUI Python app using Py2App, but am having trouble
I have written a Python TCP/IP server for internal use, using win32serviceutil/py2exe to create
I was using python to create a dictionary but as my data got larger
I usually script/program using python but have recently begun programming with JavaScript and have
I was wondering how I would go about using Python to create a Graph
I have a table created using Python + Sqlite3 c.execute('CREATE TABLE IF NOT EXISTS

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.