为什么if inputc=1: 这样的语句会出错? 求解。
python吧
全部回复
仅看楼主
level 1
eagle846 楼主
为什么if inputc=1: 这样的语句会出错? 求解,详细如下
代码如下
----------------------------
inputc = int(raw_input('choose a type'))
if inputc=1:
print 'sum a[]',suma
-----------------------------
运行的结果如下:
File "C:\Python27\myworkplace\201204\paper.py", line 41
if inputc=1:
^
SyntaxError: invalid syntax
python的版本是2.7
2012年04月29日 09点04分 1
level 1
eagle846 楼主
知道原因了 原来要用== 从basic转过来,刚起步还真不适应
2012年04月29日 09点04分 2
level 9
欢迎加入pythoner的行列[Love]
2012年04月29日 10点04分 3
level 8
。。。。。
2012年04月29日 16点04分 4
level 8
python不允许比较的同时赋值。。。。。。。。。。
2012年04月29日 16点04分 5
level 7
basic......
2012年04月30日 11点04分 6
level 1
if inputc==1 吧……………
2012年05月01日 04点05分 7
level 3
if input == 1:
2012年05月03日 06点05分 8
1