Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1057

I want to do search string in textfile(utf-8) , if string is found then i have to pick 5-10 line above and below that particular line in Python [closed]

$
0
0

Example:Serach string EVP_PKEY_get_bn_param

Code in text file

static std::vector<uint8_t> get_rsa_modulus(EVP_PKEY &pkey) {    std::unique_ptr<RSA, decltype(&RSA_free)> rsa(            EVP_PKEY_get1_RSA(&pkey),&RSA_free);    const BIGNUM *n;    EVP_PKEY_get_bn_param(keyPriv, "n", &n);    std::vector<uint8_t> result(BN_num_bytes(n));    BN_bn2bin(n, result.data());    return result;}

So if EVP_PKEY_get_bn_param is found i have to pick 5 line above and below from the file.

So Output will be

std::unique_ptr<RSA, decltype(&RSA_free)> rsa(            EVP_PKEY_get1_RSA(&pkey),&RSA_free);    const BIGNUM *n;    EVP_PKEY_get_bn_param(keyPriv, "n", &n);    std::vector<uint8_t> result(BN_num_bytes(n));    BN_bn2bin(n, result.data());    return result;

Need solution in Python. New to python

I was looking for file operations in python but didn;t solution for it.


Viewing all articles
Browse latest Browse all 1057

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>