我有一个在 Windows 上运行良好的 python3.6.0 脚本。但是当我在 bash 中运行它时,出现语法错误。这是代码:
import itertools
lines=["Hamlet","William Shakespeare","Edited Barbara B Mowat Paul Werstine","Michael Poston Rebecca Niles","Folger Shakespeare Library","httpwwwfolgerdigitaltextsorgchapter5playHam","Created Jul 31 2015 FDT version 092","Characters Play","line 17 POLONIUS father Ophelia Laertes councillor King Claudiusthis line substituted GHOST"]
LinesMap=dict()
for line in lines:
list=[l for l in line.split(' ')]
d = dict(itertools.zip_longest(*[iter(list)] * 2, fillvalue=None))
LinesMap = {**LinesMap, **d}
print(LinesMap)
这是错误:
[reza@localhost ~]$ python New\ Text\ Document.py
File "New Text Document.py", line 16
LinesMap = {**LinesMap, **d}
^
SyntaxError: invalid syntax
料青山看我应如是
蛊毒传说
ITMISS
随时随地看视频慕课网APP
相关分类