假设我有这个结构,它在给用户的 typedef struct {
cmd cmd; /// The processed command in each pipe stage
intt src1;
int src2; /// Actual value of src2 (considering forwarding mux, etc.)
} PipeStage;
头文件中定义:
sim.c
现在假设我想在 typedef struct pipeStage{
cmd cmd;
pc_t PCofCmd;
int src1;
int src2;
int dstVal;
} PipeState;
文件中展开它的字段..我该怎么做?
import json
import requests
from bs4 import BeautifulSoup
from urllib.request import urlopen
import urllib.request
session = requests.Session()
session.cookies.get_dict()
url = 'http://www.citydis.com/'
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
response = session.get(url, headers=headers)
soup = BeautifulSoup(response.content, "html.parser")
metaConfig = soup.find("meta", property="configuration")
metaConfigTxt = metaConfig["content"]
csrf = json.loads(metaConfigTxt)["pageToken"]
jsonUrl = "https://www.citydis.com/s/results.json?&q=London& customerSearch=1&page=0"
headers.update({'X-Csrf-Token': csrf})
response = session.get(jsonUrl, headers=headers)
print(response.content)
甚至可能吗?
答案 0 :(得分:0)
在评论中说明 Weather Vane 时,您可以定义一个新的Caused by: android.database.sqlite.SQLiteException: no such table: Zastavky (code 1): , while compiling: SELECT Nazev FROM Zastavky
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1316)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1255)
at com.example.geote.ap1.SearchActivity.fetchData(SearchActivity.java:52)
at com.example.geote.ap1.SearchActivity.onCreate(SearchActivity.java:29)
at android.app.Activity.performCreate(Activity.java:5990)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
,其中一个(或多个)字段属于另一个struct
(s)类型:
struct
注意强>
如果字段的顺序很重要且typedef struct {
cmd cmd; /// The processed command in each pipe stage
int src1;
int src2; /// Actual value of src2 (considering forwarding mux, etc.)
} PipeStage;
typedef struct pipeStage{
// cmd cmd;
// int src1;
// int src2;
PipeStage stage; // or it might be a pointer: PipeStage *p_stage;
pc_t PCofCmd;
int dstVal;
} PipeState;
应该在pc_t PCofCmd
之后,那么您没有太多选择,只能按原样定义新的cmd cmd;
:
struct