我想iframe从网页上获取所有内容.
码:
site = "http://" + url
f = urllib2.urlopen(site)
web_content = f.read()
soup = BeautifulSoup(web_content)
info = {}
content = []
for iframe in soup.find_all('iframe'):
info['src'] = iframe.get('src')
info['height'] = iframe.get('height')
info['width'] = iframe.get('width')
content.append(info)
print(info)
pprint(content)
Run Code Online (Sandbox Code Playgroud)
结果print(info):
{'src': u'abc.com', 'width': u'0', 'height': u'0'}
{'src': u'xyz.com', 'width': u'0', 'height': u'0'}
{'src': u'http://www.detik.com', 'width': u'1000', 'height': u'600'}
Run Code Online (Sandbox Code Playgroud)
结果pprint(content):
[{'height': u'600', 'src': u'http://www.detik.com', 'width': u'1000'},
{'height': u'600', 'src': u'http://www.detik.com', 'width': u'1000'},
{'height': u'600', 'src': u'http://www.detik.com', …Run Code Online (Sandbox Code Playgroud) 我有两张桌子.1st table => member {member_id,name,active} 2nd table => savings {savings_id,member_id,month,year,amount,type,paid}
会员表
+-----------+--------+--------+
| member_id | name | active |
+-----------+--------+--------+
| 105 | Andri | 1 |
| 106 | Steve | 1 |
| 110 | Soraya | 1 |
| 111 | Eva | 1 |
| 112 | Sonia | 1 |
+-----------+--------+--------+
Run Code Online (Sandbox Code Playgroud)
储蓄表
+------------+-----------+-------+------+--------+------+------+
| savings_id | member_id | month | year | amount | type | paid |
+------------+-----------+-------+------+--------+------+------+
| 1 | 120 | NULL …Run Code Online (Sandbox Code Playgroud) 我有数千张图片需要嵌入到我的 C# 应用程序中。我在资源中创建一个文件夹,并将我的所有文件复制到该文件夹中。我可以使用相对路径检索我的图像。但问题是我如何在发布应用程序时包含所有这些文件。
PS:我无法将所有图像导出到资源,因为我的图像文件夹包含很多子文件夹
什么是这个SQL查询的linq查询
SELECT
sum(IIF(jenis = 'primer',1,0)) as sum_primer,
sum(IIF(jenis = 'sekunder',1,0)) as sum_sekunder
FROM cooperations
Run Code Online (Sandbox Code Playgroud)
尝试从101 Linq Samples中搜索相同的示例,但没有得到任何线索
更新 所以,我在我的C#中使用此查询
var query = (from c in db_cooperations.cooperations
group c by c.jenis into g
select
(new
{
sum_primer = g.Count(c => c.jenis == "primer"),
sum_sekunder = g.Count(c => c.jenis == "sekunder")
})).ToArray();
Run Code Online (Sandbox Code Playgroud)
输出是
sum_primer sum_sekunder
0 0
0 52
250 0
0 0
0 0
Run Code Online (Sandbox Code Playgroud)
那么,我如何删除零值,然后返回一行