Answer the question
In order to leave comments, you need to log in
how to get cookie in python?
I'm trying to make a site in python without using any frameworks (argued with friends). The site has a theme change, which is implemented through a cookie.
How to get these same cookies for the right user? That is, those that were saved for this user during the last visit?
It's just that through requests an empty list is returned instead of the data that is needed.
Thanks in advance)
Answer the question
In order to leave comments, you need to log in
#include <iostream>
using namespace std;
struct package {
int status;
unsigned char data[20];
};
int main()
{
package pkg = { 0, { 0x01, 0x02, 0x03 } };
cout << pkg.status << int(pkg.data[0]) << endl;
return 0;
}
why? If you have an array and it must be filled with certain constants, then it's better to do it through a vector. Especially if it is not defined how many of them should be. It would make more sense to use something like this:
struct package {
int status = 1;
vector <byte> data;
}
int main(){
byte arr = {0x01, 0x02, 0x03};
package pkg;
for (byte u : arr) {
pkg.data.push_back(u)
}
}
for (auto a : pkg.data) {
cout << a << endl;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question