Python Context Managers and the "with" Statement (__enter__ & __exit__)

Real Python February 28, 2017
Video Thumbnail
Real Python Logo

Real Python

View Channel

About

Python tutorials and training videos for Pythonistas that go beyond the basics. 🎓🐍 Get free Python tips and programming tutorials at https://realpython.com Hey, I’m Dan Bader and I help Python developers take their coding skills and productivity to the next level. I’m an independent software engineer, author, and speaker. I’ve been developing software for 15 years—and I’d love to help you become a more proficient Python coder. On this channel you’ll get new Python videos and screencasts every week. They’re bite-sized and to the point so you can fit them in with your day and pick up new Python skills on the side: ► Free Python Articles & Tutorials: https://realpython.com ► Listen to the Real Python Podcast: https://realpython.com/podcast

You May Also Like

Python Coding Essentials You Can't Miss

AI-recommended products based on this video

Loading...
Freenove Ultimate Starter Kit for BBC micro bit (V2 Included), 316-Page Detailed Tutorial, 225 Items, 44 Projects, Blocks and Python Code

Freenove Ultimate Starter Kit for BBC micro bit (V2 Included), 316-Page Detailed Tutorial, 225 Items, 44 Projects, Blocks and Python Code

(382)
$94.95
PrimeFREE delivery Sat, Jun 14
Loading...
Freenove Ultimate Starter Kit for BBC micro bit (V2 Included), 316-Page Detailed Tutorial, 225 Items, 44 Projects, Blocks and Python Code

Freenove Ultimate Starter Kit for BBC micro bit (V2 Included), 316-Page Detailed Tutorial, 225 Items, 44 Projects, Blocks and Python Code

(382)
$94.95
PrimeFREE delivery Sat, Jun 14
Loading...
10.1 Inch Touch Portable Monitor IPS Screen 1366x768P 60Hz 400 Brightness 99% sRGB HDMI USB-C Monitors Switch for Xbox PS3/4/5 Laptop Compatible with Raspberry Pi, Mini Touch Screen

10.1 Inch Touch Portable Monitor IPS Screen 1366x768P 60Hz 400 Brightness 99% sRGB HDMI USB-C Monitors Switch for Xbox PS3/4/5 Laptop Compatible with Raspberry Pi, Mini Touch Screen

(1)
$99.99
FREE delivery Mon, Aug 11
Loading...
DHT11 modules Digital Temperature and Humidity Temperature Sensor for arduino DIY KIT 5pcs

DHT11 modules Digital Temperature and Humidity Temperature Sensor for arduino DIY KIT 5pcs

(1)
$15.99
FREE delivery Sat, Jun 14 on your first order
Loading...
UGREEN USB to USB C Adapter & USB C to USB Adapter Combo 4-Pack, 10Gbps Type-C Converter, Car Charger Compatible with MacBook Pro, iPad Mac mini, iPhone 17/16, Galaxy, PC/Laptop, Hard Drive Enclosure

UGREEN USB to USB C Adapter & USB C to USB Adapter Combo 4-Pack, 10Gbps Type-C Converter, Car Charger Compatible with MacBook Pro, iPad Mac mini, iPhone 17/16, Galaxy, PC/Laptop, Hard Drive Enclosure

(86)
$9.74
Prime
Loading...
Elebase USB to USB C Adapter 4 Pack,USBC Female to A Male Car Charger,Type C Converter for iPhone 16 Pro Max,15 14 13 12 11 Plus,Apple Watch iWatch 10 9 8,Airpods,iPad Air Mini 6 7,Samsung Galaxy S25

Elebase USB to USB C Adapter 4 Pack,USBC Female to A Male Car Charger,Type C Converter for iPhone 16 Pro Max,15 14 13 12 11 Plus,Apple Watch iWatch 10 9 8,Airpods,iPad Air Mini 6 7,Samsung Galaxy S25

(54,858)
$12.99
FREE delivery Sat, Jun 14 on your first order
1K+ bought in past month
Loading...
LISEN USB C to USB C Cable 240W, [6.6ft 2Pack]Nylon Braided Type C Cable Fast Charge for iPhone 17 Pro Max USBC Fast Charging Cord for iPhone 17 16 Pro Air Samsung Macbook iPad Air 4/5 Xbox, Midnight
Best Seller

LISEN USB C to USB C Cable 240W, [6.6ft 2Pack]Nylon Braided Type C Cable Fast Charge for iPhone 17 Pro Max USBC Fast Charging Cord for iPhone 17 16 Pro Air Samsung Macbook iPad Air 4/5 Xbox, Midnight

(4,565)
$17.99
Prime
1K+ bought in past month
Loading...
Syntech Link Cable 16FT for PCVR Compatible with Oculus/Quest 3/Meta Quest 3S, Quest2/Pro/Pico 4/Ultra Accessories and PC/SteamVR, High Speed PC Data Transfer, USB 3.0 to USB C Cable for VR Headset
Best Seller

Syntech Link Cable 16FT for PCVR Compatible with Oculus/Quest 3/Meta Quest 3S, Quest2/Pro/Pico 4/Ultra Accessories and PC/SteamVR, High Speed PC Data Transfer, USB 3.0 to USB C Cable for VR Headset

(19,554)
$24.99
FREE delivery Tue, Jun 17 on your first order
300+ bought in past month