当我使用以下代码添加列表时.
a = [1, 2, 3, 4]
print a
a.append(a)
print a
Run Code Online (Sandbox Code Playgroud)
我期待输出是......
[1, 2, 3, 4]
[1, 2, 3, 4, [1, 2, 3, 4]]
Run Code Online (Sandbox Code Playgroud)
但它是这样的......
[1, 2, 3, 4]
[1, 2, 3, 4, [...]]
Run Code Online (Sandbox Code Playgroud)
为什么?
这是代码....
#include <iostream>
int main()
{
cout << "WELCOME TO C++ PROGRAMMING";
return 0;
}
Run Code Online (Sandbox Code Playgroud)
当我去终端并通过命令..
g++ hello.cpp
Run Code Online (Sandbox Code Playgroud)
表明...
hello.cpp: In function ‘int main()’:
hello.cpp:4:2: error: ‘cout’ was not declared in this scope
cout << "WELCOME TO C++ PROGRAMMING";
^
hello.cpp:4:2: note: suggested alternative:
In file included from hello.cpp:1:0:
/usr/include/c++/4.8/iostream:61:18: note: ‘std::cout’
extern ostream cout; /// Linked to standard output
Run Code Online (Sandbox Code Playgroud)
那是什么原因?我该怎么办?