小编Bet*_*ish的帖子

连接 3-d 数组 python

我想连接空的 3d numpy 数组

   #2d array works 
   xs = np.array([[1,2,3,4,5],[10,20,30,40,50]])
   ys = np.array([]).reshape(0,5)
   zs = np.vstack([ys, xs])

   #3D does not work
   bb = np.array([]).reshape(1080, 1920, 0) # empty 

   ss = np.random.rand(1080, 1920,2) #

   dd = np.vstack([bb, ss]) # generate an error
Run Code Online (Sandbox Code Playgroud)

有可能做到吗?

python arrays numpy concatenation

2
推荐指数
1
解决办法
7883
查看次数

如何从numpy数组中删除空元素

这里有一个例子:

a = np.array([[1, 2, 3,4], [], [1,2,0,9]]) 

print(a)
# array([list([1, 2, 3, 4]), list([]), list([1, 2, 0, 9])], dtype=object)
Run Code Online (Sandbox Code Playgroud)

如何删除空元素并仅返回:

array([[1, 2, 3, 4], [1, 2, 0, 9]], dtype=object)
Run Code Online (Sandbox Code Playgroud)

arrays numpy list slice

2
推荐指数
1
解决办法
4838
查看次数

c ++中的重复符号__ZN4ArmeC1Ev错误

我是Qt的c ++编程新手.我做两个班Personnage和Arme.我有5个文件Personnage.h,personnage.cpp,Arme.h和Arme.cpp

Arme.h

#ifndef ARME_H
#define ARME_H
#include<iostream>
class Arme
{
public:
Arme();
Arme(int m_idArme,std::string m_nomArme);
void armeAffich() const;
public:
int idArme;
std::string nomArme;
};
#endif // ARME_H
Run Code Online (Sandbox Code Playgroud)

Arme.cpp

#include "Arme.h"
#include<string>
#include<iostream>
using namespace std;
Arme::Arme():idArme(0),nomArme(0)
{

}
Arme::Arme(int m_idArme,string m_nomArme)
{
idArme=m_idArme;
nomArme=m_nomArme;
}

void Arme::armeAffich() const
{
cout<<"identifiant d'arme"<<idArme<<endl;
cout<<"nom d'arme"<<nomArme<<endl;
}
Run Code Online (Sandbox Code Playgroud)

Personnage.h

#ifndef PERSONNAGE_H
#define PERSONNAGE_H
#include "Arme.h"
class Personnage
{
Personnage(std::string nom,std::string prenom);
Personnage();
~Personnage();
void affichPers() const;
public:
std::string nomPers;
std::string prenomPers;
Arme *arme; …
Run Code Online (Sandbox Code Playgroud)

c++ qt g++

1
推荐指数
1
解决办法
479
查看次数

Cout c ++有很多行

我想用cout在c ++中打印一条大消息.

例:

cout<<"Camera could not be opened in the requested access mode, because another
              application (possibly on another host) is using the camera."<<endl;
Run Code Online (Sandbox Code Playgroud)

但是我收到了一个错误.

任何帮助?

c++ cout

1
推荐指数
1
解决办法
3597
查看次数

标签 统计

arrays ×2

c++ ×2

numpy ×2

concatenation ×1

cout ×1

g++ ×1

list ×1

python ×1

qt ×1

slice ×1