语法对象I / O无效

时间:2014-03-06 04:31:48

标签: python syntax

# -*- coding: utf-8 -*-
import easygui
file = open("data.txt"[,"r+"])
Msg1 = easygui.multenterbox(title = 'ข้อมูล',fieldName=['ชื่อ','นามสกุล','ที่อยู่']
file.write(Msgl)

运行此代码,我收到错误

file.write(Msgl)
    ^ invalid syntax

太过

file = open("data.txt"[,"r+"])
^
SyntaxError: invalid syntax
Script terminated.

再次出错。的SyntaxError

1 个答案:

答案 0 :(得分:0)

试试这个:

# -*- coding: utf-8 -*-
import easygui
file = open("data.txt"[,"r+"])
Msg1 = easygui.multenterbox(title = 'ข้อมูล',fieldName=['ชื่อ','นามสกุล','ที่อยู่'])
file.write(Msgl)

正如另一张海报所说,你错过了一个右括号,它正在包裹到下一行,导致错误。