SEGUID from python to c++
SEGUID from python to c++
我正试图在C++中做到这一点,我在Python中有一些代码,但我不知道如何使其在C++中工作
def seguid(seq):
try:
#Python 2.5 sha1 is in hashlib
import hashlib
m = hashlib.sha1()
except:
#For older versions
import sha
m = sha.new()
import base64
try:
#Assume its a Seq object
seq = seq.tostring()
except AttributeError:
#Assume its a string
pass
m.update(_as_bytes(seq.upper()))
try:
#For Python 2.5+
return base64.b64encode(m.digest()).rstrip("=")
except:
#For older versions
import os
#Note: Using os.linesep doesn't work on Windows,
#where os.linesep= "rn" but the encoded string
#contains "n" but not "rn"
return base64.encodestring(m.digest()).replace("n","").rstrip("=")
i认为您可以将python代码嵌入C/C++代码中。有关详细信息,请参阅以下链接。
http://www.codeproject.com/Articles/11805/Embedding-Python-in-C-C-Part-I
http://www.linuxjournal.com/article/8497
相关文章:
- "error: no matching function for call to"构造函数错误
- 调用专用模板时出错"no matching function for call to [...]"
- C++ Singleton - Prevent ::instance() to variable
- 我的项目不会像"undefined reference to `grpc::g_core_codegen_interface'"那样使用未定义的引用错误进行编译
- Visual Studio Code "undefined reference to `WinMain@16'"
- 使用 GCC 卸载的 OpenMP 卸载失败,并出现"Ptx assembly aborted due to errors"
- 如何解决"invalid conversion from 'char' to 'const char*'"
- 使用 MATLAB 编码器生成C++代码:编译错误"undefined reference to `rgb2gray_tbb_real64'"
- 尝试链接我的着色器时,我收到错误代码"error c5145 must write to gl_position"
- Python str to C++ to Python str
- 为什么创建友元类的实例会导致"undefined reference to"错误?
- System.InvalidCastException - SQL to C++ - safe_cast<float>
- 使用 cmake 的 Linux 终端上的"Conversion to non-scalar type is requested"错误
- "no matching function for call to 'Vector::Vector'"错误
- vector<vector<double>> to mxArray using memcpy
- Tensorflow c++ api undefined reference to 'tflite::D efaultErrorReporter()'
- 当覆盖存在时调用基本虚拟"binded to object"函数
- OpenGL VBO Indexing ( How to compute Index Array)
- 为什么我会" void value not ignored as it ought to be"?
- C++:如何将 unix 时间的字符串转换为 *tm?(使用时间错误:"cannot convert 'String' to 'tm*' ")