Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exporting data from web (Trello)
#4
Quote:1. When you say you have saved the script as Shafla.json, I have saved it and an IDLE file which will actually be Shafla.json.py is that correct??
No -- save it as yourfilename.json.
Json is a text file with a particular format.
so:
  • copy your listing from post 1 to a text file.
  • Delete the top three lines (now 1st line should begin with {
  • Save to a text file with .json suffix, call it whatever you want, but make sure suffix is .json

Quote:2. In line 2 it says import os. What is os?
os is a built-in python package. Miscellaneous operating system interfaces https://docs.python.org/3/library/os.html
the code os.chdir(os.path.abspath(os.path.dirname(__file__))) assures that when I try to open a file, I'm
looking for it in the script directory (where the program resides).

Quote:3. In line 6 there is an option to insert file. is this the exel file i intend to import the information to?
??? Don't know what you're looking at.

Quote:Would it be possible to add some comments to the code explaining each step? eg Line 8

Study the code, most of it is pretty basic, The DisplayDict method is a generic method that will display contents of any dictionary, It uses some techniques (includes recursion (calls itself)) that you shouldn't worry about until you you are more familiar with python. if you have a specific question, ask here and I will answer.

Quote:what is 'r' and fp?
On the open statement 'r' means read mode. fp is just a file handle I assign to the instance, this could have been fileptr or myfilename, or whatever your fancy. For me fp is short for file pointer.

Quote:in line 16 what is f'?
f stands for f-string it was implemented in python 3.6, it allows for abbreviated formatting of data, see: https://docs.python.org/3/whatsnew/3.6.h...w36-pep498
print(f'\n{indent}{key}') new format
print('\n{}{}'.format(indent, key) old format

Quote:5. If i am trying to automate the process of exporting this information and importing it to an excel sheet would i have to export the json file every time or is there a better way?
what is the original source. If not a spreadsheet, you are over complicating the process.
It's better to use the original json source.

FYI: Please do not send PM, It's best to ask all questions here, that way others can benifit.
You really need to take an elementary python tutorial,I'd suggest:
https://interactivepython.org/runestone/...index.html
or
https://www.python-course.eu/python3_course.php
Reply


Messages In This Thread
Exporting data from web (Trello) - by Shafla - May-11-2019, 07:37 PM
RE: Exporting data from web (Trello) - by Larz60+ - May-12-2019, 12:16 AM
RE: Exporting data from web (Trello) - by Shafla - May-12-2019, 09:01 PM
RE: Exporting data from web (Trello) - by Larz60+ - May-13-2019, 12:50 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Exporting excel data to website bdarragh00 1 2,628 Jun-15-2018, 08:57 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020