This has nothing to do with PyCharm, you are just closing your file before use.
This should work
with open ('anscombe.csv', 'r') as datafile:
csv_reader = csv.reader(datafile)
for line in csv_reader:
print(line)
with
opens the file at the start of the block and closes it at the end by calling the __enter__
and __exit__
methods of file at start and end. For more information read: https://www.python.org/dev/peps/pep-0343/
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…