'pycharm ide gives syntax error with python 3.10 but code is working fine
Solution 1:[1]
Try removing the parenthesis, and:
with open(file = "file1") as file1, open(file="file2") as file2:
print(file1)
print(file2)
Works for me, p.s. I'm using PyCharm 2021.2.2 Professional Edition on Ubuntu.
Solution 2:[2]
As mentioned by Pavel Karateev in the comments, this is a bug in PyCharm, still as of 2022-03-09.
All we can do is vote for and await the resolution of issue PY-42200.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Shaheer Hassan |
| Solution 2 | gertvdijk |

