2

The code below will list all my repos. But is there any way to add 3 more columns to include the creation date, language and type (for e.g. Sources / Forks)? I'm using the PyGithub package.

from github import Github
g = Github("user_name", "passwd")
for repo in g.get_user().get_repos():
    print(repo.name)
Ray Booysen
  • 27,046
  • 13
  • 81
  • 110
shantanuo
  • 30,102
  • 75
  • 225
  • 364

1 Answers1

5

The Repository class does have (assuming PyGithub/PyGithub)

So you can use those attributes and print them in column, using a format string (Python 2.6+, as seen here)

for repo in g.get_user().get_repos():
    print("{: >20} {: >20} {: >20}  {: >20}".format(repo.name, repo.language, repo.created_at, repo.fork))
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755