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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:16:03+00:00 2026-06-15T19:16:03+00:00

I am new to Python coding and havent been able to progress on this.

  • 0

I am new to Python coding and havent been able to progress on this. I have some time encoded filenames in the following format:

20121208151318.gzip
20121208151320.gzip
20121208151322.gzip
20121208151325.gzip
20121208151326.gzip

Using this code I can print the filenames of all the files in my S3 bucket:

import boto
s3conn = boto.connect_s3()
bucket = s3conn.lookup('my_bucket_name')
for key in bucket:
  print k.name

key.getfile()

I need help with two aspects. Firstly how can I get the name of the most recent file in the bucket, which would in my case be:

20121208151326 (15:13:26 - 8th December 2012)

Secondly, how can I then download this file? I found the key.getfile() command but I cant work how to implement it.

  • 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-15T19:16:04+00:00Added an answer on June 15, 2026 at 7:16 pm

    Based on your format latest = max(keys) should get the latest item

    To download the content of of the file your can use

    latest.get_contents_to_filename(<file_name>)
    

    or

    latest.get_contents_to_file(<file>)
    

    See more details in boto documentations for S3

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

Sidebar

Related Questions

I really new to Python and coding in general, but I have been making
I am new to coding python. I am hoping to modify this code to
Very new to python and can't understand why this isn't working. I have a
I have the following python modules. Sorry if the code is ugly. This is
I have the following code: #!/usr/bin/python # -*- coding: iso-8859-15 -*- import pygame, random
I'm new to C# coming from a python background. I've had a hard time
New to Python, have a simple, situational question: Trying to use BeautifulSoup to parse
I'm completely new to python (and it's been a while since I've coded much).
I am new to python and coding in general and I need help with
I am writing some Python code to implement some of the concepts I have

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.