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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:59:06+00:00 2026-06-06T12:59:06+00:00

This is another probably very simple question, but I haven’t been able to find

  • 0

This is another probably very simple question, but I haven’t been able to find anything to fix it so far.

I’m trying to add 14 days to some dates in a list of 2000 lists (each list is ['number1','number2','Day Month Year']) and put the new date as a value at the end of each list (i.e. each list becomes ['number1', 'number2', 'Day Month Year', 'Day Month Year']).
What I’ve got so far is:

from datetime import timedelta
listf=[]
z=range(len(hinfo))
for i in z:
    datetime.datetime.strptime(hinfo[i][2],'%d %b %y')
    listf.append(hinfo[i][2]+timedelta(days=14))

But this brings up the error ‘ValueError: unconverted data remains: 01’. All of the dates in the list should be fine so I can’t figure out why the errors coming up.
Forgive a beginner if it’s just a simple mistake 🙂

Thanks!

  • 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-06T12:59:08+00:00Added an answer on June 6, 2026 at 12:59 pm

    The correct code that appends the new date to the original list, as you specified in your question:

    from datetime import timedelta
    import datetime
    
    hinfo = [['C148', 'W29', '08 August 2001'], ['Q964', 'R72', '21 May 2003']]
    
    for i, h in enumerate(hinfo):
        if h[2] == '': # error checking
            del hinfo[i]
            continue
        d = datetime.datetime.strptime(h[2], '%d %B %Y')
        d += timedelta(days=14)
        h.append(d.strftime('%d %B %Y'))
    
    print hinfo
    

    For me, this prints [['C148', 'W29', '08 August 2001', '22 August 2001'], ['Q964', 'R72', '21 May 20
    03', '04 June 2003']]
    , which is what you wanted, if I understood your question correctly.

    If you get an error, it is most likely that the input is not as you said, or think it is.

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

Sidebar

Related Questions

Okay, this is (probably) a very simple question, but I am afraid I know
All, This question probably has a very simple answer - something I'm overlooking. But
This is probably a very simple and stupid question to ask, but I have
I'm aware this is probably a very simple problem with a 1-line-of-code answer but
This is probably a very simple question to answer. i am new to Rails
This will probably be just another unsolved thread but i'll fill in some info
This seems like another fairly simple thing to do, but I'm again struggling on
I'm probably missing something very simple but I'm new and it's just easier to
I am new to SQL, so this is probably very simple, however, I wasn't
this is another question that I want to know that how to apply any

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.