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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:06:33+00:00 2026-05-30T21:06:33+00:00

hey i am currently just to get the data from the file for example

  • 0

hey i am currently just to get the data from the file

for example here a line from the file

Jan 10 09:32:07 j4-be03 sshd[3876]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=218.241.173.35  user=root

here the current code i am using but cant seem to achieve it when am spliting it

for line in myFile:
    list_of_line = line.split()
    date = list_of_line[0:3]
    print '\'',date,'\''
    if login_ctns.has_key(date):
        login_counts = login_ctns[date]
        login_counts = login_counts +1
        login_ctns[date] = login_counts
        #zero out the temporary counter as a precaution
        count_login =0
    else:
        login_ctns[date] = 1

print date
  • 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-30T21:06:35+00:00Added an answer on May 30, 2026 at 9:06 pm

    Your code is making date a list, which can’t be used as a dict key.

    Try:

    date = ' '.join(list_of_line[0:3])
    

    instead.

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

Sidebar

Related Questions

Hey guys, I currently present my mp3s by referencing their file location into a
Hey all, here is the issue I am currently trying to work through. We
Hey, I want to store application configuration data. Currently, I'm using INIs but they
Hey, I've tried researching how to POST data from java, and nothing seems to
Hey, I'm currently trying to send an image file to a web server using
Hey, I'm currently trying to extract information from a 3d array, where each entry
Hey guys I have a query that currently finds the latest comment for each
Hey, i am currently working on a django app for my studies, and came
Hey All, I currently use Google's API to include jQuery into my sites like
Hey guys quick question, I currently have an insert statement $query= INSERT into new_mail

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.