Python 3.5: Invalid syntax with split('/').[-1] -
in virtual env, using python 3.5.2. when run
python file.py . below error
filename = source_path.split('/').[-1] ^ syntaxerror: invalid syntax
for code snippet
for line in lines: source_path = line[0] filename = source_path.split('/').[-1]
i saw similar post op got error using python 2.7. using 3.5.2 in virtual environment. missing?
there no .
before []
filename = source_path.split('/')[-1] # ^^
Comments
Post a Comment