我对下面的代码有疑问。为什么:
不打印冒号 ( ) 等特殊字符?
lista = ("KK",3,'go');
listb = [':b2:','bthree','b7'];
print lista;
print listb; # works
lista = ("KK",3,':go');
print lista; # Show Nothing: what's wrong (I am lost)
您提供的示例代码工作正常,带有冒号的数据完全按照您的预期打印。你一定在做其他不正确的事情。
it works
python
>>> lista = ("KK",3,'go')
>>> listb = [':b2:','bthree','b7']
>>> print lista
('KK', 3, 'go')
>>> print listb
[':b2:', 'bthree', 'b7']
can you paste a bigger chunk of program? the problem is definitely somewhere else!
furthermore your title says: "While Loop In Python?"... there are NO LOOPS in your code!
您的代码应该可以工作,请尝试删除分号;分号在 Python 中不是必需的,但在 Javascript 中是必需的。
lista = ("KK",3,'go')
listb = [':b2:','bthree','b7']
print lista
print listb
它完美地工作......
>>> lista = ("KK",3,'go')
>>> listb = [':b2:','bthree','b7']
>>> print lista
('KK', 3, 'go')
>>> print listb
[':b2:', 'bthree', 'b7']
我不明白你的问题(0_o)