尝试用变量替换字符串中#的所有实例.它没有工作,但也没有重新调整任何错误.
answer_form = '<textarea name="answer_#" rows="5"></textarea>'+
'<input type="file" name="img_#" />';
question_num = 5;
answer_form.replace(/#/g, question_num);
Run Code Online (Sandbox Code Playgroud)
哈希仍然存在.
不确定我错过了什么?
使用NetworkX和新的库,进行社交网络分析查询.通过查询,我的意思是按边缘节点的属性选择/创建子图,其中边创建路径,节点包含属性.该图表使用的是表格的MultiDiGraph
G2 = nx.MultiDiGraph()
G2.add_node( "UserA", { "type" :"Cat" } )
G2.add_node( "UserB", { "type" :"Dog" } )
G2.add_node( "UserC", { "type" :"Mouse" } )
G2.add_node( "Likes", { "type" :"Feeling" } )
G2.add_node( "Hates", { "type" :"Feeling" } )
G2.add_edge( "UserA", 'Hates' , statementid="1" )
G2.add_edge( "Hates", 'UserB' , statementid="1" )
G2.add_edge( "UserC", 'Hates' , statementid="2" )
G2.add_edge( "Hates", 'UserA' , statementid="2" )
G2.add_edge( "UserB", 'Hates' , statementid="3" )
G2.add_edge( "Hates", 'UserA' , statementid="3" )
G2.add_edge( "UserC", 'Likes' , statementid="3" …Run Code Online (Sandbox Code Playgroud)