我正在使用enron电子邮件数据集,我正在尝试删除没有"@ enron.com"的电子邮件地址(即我只想发送enron电子邮件).当我试图在没有@enron.com的情况下删除这些地址时,由于某些原因,一些电子邮件被忽略了.下面显示了一个小图,其中顶点是电子邮件地址.这是gml格式:
Creator "igraph version 0.7 Sun Mar 29 20:15:45 2015"
Version 1
graph
[
directed 1
node
[
id 0
label "csutter@enron.com"
]
node
[
id 1
label "steve_williams@eogresources.com"
]
node
[
id 2
label "kutner.stephen@enron.com"
]
node
[
id 3
label "igsinc@ix.netcom"
]
node
[
id 4
label "dbn@felesky.com"
]
node
[
id 5
label "cheryltd@tbardranch.com"
]
node
[
id 6
label "slover.eric@enron.com"
]
node
[
id 7
label "alkeister@yahoo.com"
]
node
[
id 8
label "econnors@mail.mainland.cc.tx.us"
] …Run Code Online (Sandbox Code Playgroud) 我正在分析一些我从android设备中提取的数据库,我注意到有些数据库没有更新,但它们附带了两个文件:.db-shm和.db-wal,这些文件在我对其进行任何更改时都会更新数据库(而.db文件不是).我知道这些是数据库使用的文件,可以随时回滚.但我的问题是:我可以将更改(或传输新数据)从.db-wal和.db-shm应用到主数据库(扩展名为.db)吗?如何?
任何帮助表示赞赏.谢谢
我有一个名为EventManager的类,我在每个模块中调用这个类.我想到在主文件中创建一个EventManager的实例,并在每个模块中使用该实例.我的问题是:
我有以下程序逐字读取文件并将该字再次写入另一个文件但没有第一个文件中的非ascii字符.
import unicodedata
import codecs
infile = codecs.open('d.txt','r',encoding='utf-8',errors='ignore')
outfile = codecs.open('d_parsed.txt','w',encoding='utf-8',errors='ignore')
for line in infile.readlines():
for word in line.split():
outfile.write(word+" ")
outfile.write("\n")
infile.close()
outfile.close()
Run Code Online (Sandbox Code Playgroud)
我面临的唯一问题是,使用此代码时,它不会向第二个文件(d_parsed)打印新行.任何线索?
我正在使用igraph(Python),并希望获得有向图中两个节点之间的所有可能路径.我知道这个函数get_all_shortest_paths是最短的路径,但找不到一般的函数.
更新:
我的主要目标是获取这些路径中的所有节点,以便我可以获得这些节点的子图.
我试图获取从服务器检索的特定cookie的到期时间:
s = requests.session()
r = s.get("http://localhost/test")
r.cookies
Run Code Online (Sandbox Code Playgroud)
这将列出服务器发送的所有cookie(我得到2个cookie):
<<class 'requests.cookies.RequestsCookieJar'>[<Cookie PHPSESSID=cusa6hbtb85li8po
argcgev221 for localhost.local/>, <Cookie WebSecu=f for localhost.local/test>]>
Run Code Online (Sandbox Code Playgroud)
当我做:
r.cookies.keys
Run Code Online (Sandbox Code Playgroud)
我明白了:
<bound method RequestsCookieJar.items of <<class 'requests.cookies.RequestsCooki
eJar'>[Cookie(version=0, name='PHPSESSID', value='30tg9vn9376kmh60ana2essfi3', p
ort=None, port_specified=False, domain='localhost.local', domain_specified=False
, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires
=None, discard=True, comment=None, comment_url=None, rest={}, rfc2109=False), Co
okie(version=0, name='WebSecu', value='f', port=None, port_specified=False, doma
in='localhost.local', domain_specified=False, domain_initial_dot=False, path='/test', path_specified=False, secure=False, expires=1395491371, discard=Fals
e, comment=None, comment_url=None, rest={}, rfc2109=False)]>>
Run Code Online (Sandbox Code Playgroud)
如您所见,我们有两个cookie.我想获得名为"WebSecu"的cookie的到期时间
谢谢