Skip to main content
dushanks9230
New Participant
May 30, 2023 9:39 AM UTC
Question

variables in a 'with' statement?

Is it possible to declare more than one variable using a with statement in Python?

Something like: 

from __future__ import with_statement

with open("out.txt","wt"), open("in.txt") as file_out, file_in:
    for line in file_in:
        file_out.write(line)

1 reply

harshitb6843
Brainy
May 30, 2023 9:41 AM UTC

This is an Appian forum. We do not discuss python doubts here. Maybe Stackoverflow is what you need.