튜토리얼파이썬 구문 에러()
http://docs.python.org/2/tutorial/inputoutput.html
>>> with open('workfile', 'r') as f:
... read_data = f.read()
>>> f.closed
True
내 코드는 파이썬에서
이유는 구문 오류이다 ??
튜토리얼파이썬 구문 에러()
http://docs.python.org/2/tutorial/inputoutput.html
>>> with open('workfile', 'r') as f:
... read_data = f.read()
>>> f.closed
True
내 코드는 파이썬에서
이유는 구문 오류이다 ??
2.7.5에서 코드를 실행하고 있지 않습니다. 아마 2.4 또는 2.5 일 것입니다.
~$ ~/sys/Python-2.5.6/python
Python 2.5.6 (r256:88840, Jul 12 2012, 12:21:58)
[GCC 4.6.3] on linux3
Type "help", "copyright", "credits" or "license" for more information.
>>> with open("fred") as f:
<stdin>:1: Warning: 'with' will become a reserved keyword in Python 2.6
File "<stdin>", line 1
with open("fred") as f:
^
SyntaxError: invalid syntax
import sys
및 print sys.version
당신이 사용하고있는 실제 버전을보고 추가합니다.
아무 것도 없으므로 코드의 다른 부분에서 문제가 발생합니다. –
다시 시도 할 수 있습니까? 내게 잘 어울린다 – karthikr
그 진술을 둘러싼 코드를 보여줄 수 있습니까? – Evert