我正在创建一个网页,并希望在另一个视图中使用来自一个视图的信息。我正在通过python生成javascript代码,但是我在创建的其中一个字符串上遇到问题导致Private Sub Worksheet_Change(ByVal Target As Range)
Dim R1 As Range
Dim R2 As Range
Dim InRange As Boolean
Set R1 = Range(Target.Address)
Set R2 = Range("C2:C20")
Set InterSectRange = Application.Intersect(R1, R2)
InRange = Not InterSectRange Is Nothing
Set InterSectRange = Nothing
If InRange = True Then
R1.Offset(0, 1).Value = Now()
End If
Set R1 = Nothing
Set R2 = Nothing
End Sub
语法错误。
我在python中创建字符串,如下所示:
unexpected token illegal
最终在js中看起来像这样:
sep = max([len(k) for k in self.keys()])
infoString = "\n".join([("(%s)%s %s" % (k," "*(sep-len(k)),v)) for k,v in self.iteritems()])
GANTTBlock.setInfo("SIMPL-Task block representation:%s" % infoString)
基于控制台,错误发生在第一行(var SAT_2B = [
{label: "COMMRequest", times: [{"color":"Red", "label":"Task ID: 1", "starting_time":1420228800000, "ending_time":1420257600000, "TASKID":"1", "TASKCLASS":"COMM", "info":"SIMPL-Task block representation:(SCI_STORED_RAW) 0
(SEQUENCE_OVERRIDE)
(REQ_FILENAME) /Users/kerrywahl/Desktop/PlanningPersonelInterface/SIMPLCode/Input/Test/CYGNSS_MOC_COMM_Req_2015_001.txt
(RETRANSMIT)
(SCI_STORED_DDM) 0
(NOTES) Auto Generated NOMINAL COMM Request<req TASK_ID:1>
(ENG_STORED_NOM) 0
(IS_SIMPL_TASK) True
(RATE) HIGH_RATE
(DURATION) 500.0
(WINDOW_END) 2015-01-03 04:00:00.000000
(WINDOW_START) 2015-01-02 20:00:00.000000
(TASK_ID) 1
(TaskClass) COMM
(PASS_SETUP) AUTO
(PRIORITY) 5
(TASK_NAME) SAT_2B_COMM_NOMINAL_1_req
(PHASE) REQUEST
(ENG_STORED_DIAG) 0
(TYPE) NOMINAL
(SAT) 2B"}, {"color":"Red", "label":"Task ID: 6", "starting_time":1421092800000, "ending_time":1421121600000, "TASKID":"6", "TASKCLASS":"COMM", "info":"SIMPL-Task block representation:(SCI_STORED_RAW) 0
(SEQUENCE_OVERRIDE)
(REQ_FILENAME) /Users/kerrywahl/Desktop/PlanningPersonelInterface/SIMPLCode/Input/Test/CYGNSS_MOC_COMM_Req_2015_001.txt
(RETRANSMIT)
(SCI_STORED_DDM) 0
(NOTES) Auto Generated NOMINAL COMM Request<req TASK_ID:6>
(ENG_STORED_NOM) 0
(IS_SIMPL_TASK) True
(RATE) HIGH_RATE
(DURATION) 500.0
(WINDOW_END) 2015-01-13 04:00:00.000000
(WINDOW_START) 2015-01-12 20:00:00.000000
(TASK_ID) 6
(TaskClass) COMM
(PASS_SETUP) AUTO
(PRIORITY) 5
(TASK_NAME) SAT_2B_COMM_NOMINAL_6_req
(PHASE) REQUEST
(ENG_STORED_DIAG) 0
(TYPE) NOMINAL
(SAT) 2B"}]},
{label: "COMMPlan", times: []},
{label: "COMMOperation", times: []},
];
)。我尝试将字符串的{label: "COMMRequest", times: [{"color"...
部分(info
之后的所有内容)更改为常规&#34; foo&#34;字符串然后它工作正常。我尝试删除"info":
但仍然出错。我无法弄清楚导致问题的原因。
修改
如果我在标签的\n
部分内只有一个{}
,但在第二个times:
的{{1}}部分中断,则可以正常工作。
答案 0 :(得分:0)
您无法在控制台中拥有此类换行符。对于多行字符串,您需要每行以\
结尾:
var SAT_2B = [
{label: "COMMRequest", times: [{"color":"Red", "label":"Task ID: 1", "starting_time":1420228800000, "ending_time":1420257600000, "TASKID":"1", "TASKCLASS":"COMM", "info":"SIMPL-Task block representation:(SCI_STORED_RAW) 0/n
(SEQUENCE_OVERRIDE) \
(REQ_FILENAME) /Users/kerrywahl/Desktop/PlanningPersonelInterface/SIMPLCode/Input/Test/CYGNSS_MOC_COMM_Req_2015_001.txt\
(RETRANSMIT) \
(SCI_STORED_DDM) 0\
(NOTES) Auto Generated NOMINAL COMM Request<req TASK_ID:1>\
(ENG_STORED_NOM) 0\
(IS_SIMPL_TASK) True\
(RATE) HIGH_RATE\
(DURATION) 500.0\
(WINDOW_END) 2015-01-03 04:00:00.000000\
(WINDOW_START) 2015-01-02 20:00:00.000000\
(TASK_ID) 1\
(TaskClass) COMM\
(PASS_SETUP) AUTO\
(PRIORITY) 5\
(TASK_NAME) SAT_2B_COMM_NOMINAL_1_req\
(PHASE) REQUEST\
(ENG_STORED_DIAG) 0\
(TYPE) NOMINAL\
(SAT) 2B"}]},
{label: "COMMPlan", times: []},
{label: "COMMOperation", times: []},
];