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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:17:12+00:00 2026-05-25T14:17:12+00:00

I have a dictionary with a list as a value such as: numlist =

  • 0

I have a dictionary with a list as a value such as:

numlist = {'Person': ['2342342', '15:05']}

I pickle it.

outfile = open{"log.txt", "wb")
pickle.dump(numlist, outfile)

I unpickle it.

infile = open("log.txt", "rb")
pickle.load(infile)

How do I convert this binary data back to it’s original format? (a dictionary with the variable ‘name’ as the key, and the list with two items(a variable ‘number’ for the number and ‘calltime’ for the time) as the value)?

  • 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-25T14:17:12+00:00Added an answer on May 25, 2026 at 2:17 pm

    OK, let’s try it:

    In [22]: import pickle
    
    In [23]: numlist = {'Person': ['2342342', '15:05']}
    
    In [24]: outfile = open("log.txt", "wb")
    
    In [25]: pickle.dump(numlist, outfile)
    
    In [26]: outfile.close()
    
    In [27]: infile = open("log.txt", "rb")
    
    In [28]: pickle.load(infile)
    Out[28]: {'Person': ['2342342', '15:05']}
    

    As you can see, I got back exactly what I’ve started with (numlist). The only thing that’s changed compared to your code is that I close outfile before re-opening it, to make sure that the buffers get flushed.

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

Sidebar

Related Questions

I have a function, that returns the next higher value of a Dictionary-Keys-List compared
I have a Dictionary with key of type UInteger and the value is List(Of
I have a dictionary which has value as a list. dictionary = { 'C1'
I have a Dictionary<string, List<Order>> and I want to have the list of keys
I have a list string tag. I am trying to initialize a dictionary with
Let's say I have a list: a = ['apple', 'carrot'] and a dictionary: d
I have an object allStudents = Dictionary<ClassRoom, List<Student>>() In Linq how would I get
A lot of the collection classes in .Net (i.e., List<T>, Dictionary<TKey, TValue>) have an
Does VBA have dictionary structure? Like key<>value array?
I have a dictionary d (and a seperate sorted list of keys, keys ).

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.