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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:24:04+00:00 2026-05-24T10:24:04+00:00

I like to store my data after a longish python program as dictionaries in

  • 0

I like to store my data after a longish python program as dictionaries in a new script. This then allows me to import the program (and hence data) easily for further manipulation.

I write something like this (an old example):

file = open(p['results']+'asa_contacts.py','w')
print>>file, \
'''
\'''
This file stores the contact residues according to changes in ASA
as a dictionary
\''' 
d = {}
'''

followed by a lot of faffing around entering the dictionary code as a string:

print>>file, 'd[\'%s\'] = {}'               %st

I was wondering if there was a module which did this automatically as it would save me a lot of time.

Thank you

Edit: it may be useful to know that these dictionaries are usually several layers deep like this one I’m using today:

d[ratio][bound][charge] = a_list
  • 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-24T10:24:04+00:00Added an answer on May 24, 2026 at 10:24 am

    I am not sure if this is what you are looking for but try the inbuilt function repr.

    repr(a)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to store some data in Python in a similar form to a
I have data in a python dictionary that I'd like to store in a
I'd like to store some data in a cookie and my initial though was
I'd like to store additional data if a particular value is chosen in the
when I store data in a variable like: // inside the login page $_SESSION['username']
I would like to store log4net config data in my application.config file. Based on
Some web applications, like Google Docs, store data generated by the users. Data that
I'd like to pre-store a bunch of function calls in a data structure and
I have a data.frame in R that looks like this: score rms template aln_id
I have some data which my program discovers after observing a few things about

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.