Note that this site is in currently in version 1.0.0-alpha.   Some functionality may be limited.

Introduction to Python

Python is a general-purpose programming language suitable for a wide variety of tasks in the digital humanities. Learning Python fundamentals is a gateway to analyzing data, creating visualizations, composing interactive websites, scraping the internet, and engaging in the distant reading of texts. This workshop first introduces participants to core programming concepts such as data types, variables, and functions. Participants will then learn about basic control flow by writing small programs with loops and conditional statements. They will also learn to problem solve, and practice searching for answers and debugging scripts. The workshop wraps up by exposing participants to intermediate tools for further exploration.

In this workshop, you will learn to:

  • Become familiar with core programming concepts, including variables, loops, and conditionals.
  • Distinguish among five core data types—integers, floats, strings, booleans, and lists.
  • Engage with error output and use the internet and documentation to independently research language features.
  • Learn how to find and import code from external sources to solve more complex problems.
  • Run Python programs, both by interacting directly with the interpreter and by preparing and running scripts.
  • Understand what Python is and, in general terms, what it can do.

Before you get started

In this section, we want to introduce some central steps that you want to take before you get started with this workshop. For instance, there are workshop suggestions that you may want to engage with before you start this workshop, some required or recommended software installations, some files from external sources to download, etc.


This is a list of workshops that we suggest you engage with before you get started with this one. They are listed here as they contain some central concepts or tools that you may need before you can digest all the information you will be presented in this workshop.

Introduction to the Command LineRequired

This workshop makes reference to concepts from the Command Line workshop, and having basic knowledge about how to use the command line will be central for anyone who wants to learn about programming with Python.


Software installations

Some software is required for you to participate in this workshop, other is recommended. This is a list of the prerequisite installations that are required of you, a link to each of their instructions (your operating system should have been highlighted below, as long as we have them available) and an indication as to whether it is required or not.


Why am I learning this? Why does it matter? How will it help my project? Learning new digital skills is an investment of your valuable time, so it is reasonable to want to know—essentially—what will I get out of taking this workshop? The materials below help situate the skills you are about to learn within a larger context of how they are used, by whom, and to what ends.

Ethical considerations

Digital tools and the skills required to use them are part of our culture and, therefore, never neutral. Digital humanists and social scientists consider the ethical challenges and responsibilities of the tools and methods that they use. The following materials are designed to introduce you to issues you may want to consider as you learn this new skill and decide how to integrate it into your own research and teaching.

As we learn about the python data types and grammar, keep in mind that working within any digital format requires making seemingly neutral choices that carry ethical consequences. When using python, be aware of the ways the ways that data is transformed into computable form. What choices are you making about your data? What is being included, and what is left out? What are reductions and assumptions necessary to encode your data? If you are more interested in thinking further about data types and our choices in relation to data, you should have a look at our Data Literacies workshop.

Python works by reducing data to portable units and presenting them in a way that prioritizes readability. These units are known as “data types” and include strings (words/letters), integers (numbers), booleans (true or false statements), and lists (groups of strings). The python grammar, which dictates how python statements ought to be ordered, values simplicity, efficiency, and concision. You can read more about python values at the Zen of Python.

Readings before you get started

The readings listed below situate what you are about to learn in cultural contexts, such as a particular humanities or social science field, the information or computer sciences, or popular discourse. The purpose of the readings is to provide a theoretical framework you can use to contextualize how you intend to use the skill or tool introduced in this workshop.

Five Reasons Why Learning Python Is The Best Decision
Want to learn programming, but not convinced that the Python language is the right language? Check out “Five Reasons Why Learning Python Is The Best Decision,” Medium.
What Can I Do With Python?
Some concrete ideas for how to use Python: “What Can I Do With Python?” Real Python.

Projects related to Introduction to Python

The following are sample projects that use the skill or tool (either implicitly or explicitly) that you are about to learn. Some skills that are foundational may seem not to lead to a specific project goal that you have in mind. You might be surprised to learn that the following projects depend on the skills learned in this workshop.

The NEH Impact Index
Built by former Digital Fellow Patrick Smyth, The NEH Impact Index makes visible the distribution of funds by National Endowment for the Humanities across the United States. The website uses python to map projects, communities, and cultural institutions who have received NEH support. You can check out the code on Github.
Mapping Arts NYC
Mapping Arts NYC, created in 2019 by the Graduate Center’s Data for Public Good fellows, “is a project that explores the geography and representation of arts and culture in New York City over time.” It includes a number of Python scripts written to clean and make sense of all the data.
Python programmers build and maintain various “libraries,” or collections of python code, that can be re-purposed toward custom projects. You might check out the Scrapy library for web scraping, the NumPy library for numerical computing, or the pandas library for data analysis and manipulation. Check out the individual websites to help you think about the data that you want to work with.

Cheat sheets related to Introduction to Python

An introduction to what cheat sheets are and what they do in our frontmatter section (and why we have them on the site altogether).

Digital Fellows’ Python Cheat Sheet
See the Digital Fellows’ Python Cheat Sheet for handy commands that we cover in this workshop.

Meet your instructor

Filipa Calado is a Ph.D. candidate in English at the Graduate Center, CUNY. She is interested in digital tools that change the way we read and study 20th century queer literatures. Her dissertation takes a critical look at a variety of digital tools to analyze manuscripts, diaries, journals, and memoirs by queer writers. Here, she explores how digital methods can disrupt expectations about reading and analytical practices. She is a Digital Fellow for the GC Digital Initiatives, where she leads workshops on Python and Text Encoding with TEI, and works with the Digital Archive Research Collective. She teaches Latinx Literature at Hunter College, CUNY.