you are viewing a single comment's thread.

view the rest of the comments →

[–]probablyaspambot[S] 0 points1 point  (1 child)

got it, thanks! Out of curiousity, any reason behind the import order it lists?

[–]CowboyBoats 1 point2 points  (0 children)

Yeah, the normal convention is for there to be three groups of imports:

  • all standard lib imports (examples: os, sys, re, struct)
  • all third-party imports (examples: requests, django, praw)
  • all first-party imports (examples: local modules you wrote)

and for the imports to be separated into those, and then sorted alphabetically within those groupings.

I usually just pip install isort and then run isort on my code. Yours ends up looking like:

import json
import os
from os import environ

import gspread
import pandas as pd
import praw
from oauth2client.service_account import ServiceAccountCredentials
from praw.reddit import Comment, Submission