Skip to main content
dushanks9230
May 30, 2023
Question

variables in a 'with' statement?

  • May 30, 2023
  • 1 reply
  • 0 views

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
May 30, 2023

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