tkinter当我使用运行时,我的程序运行良好PyCharm,当.exe使用pyinstaller 创建文件时,pyinstaller -i"icon.ico" -w -F script.py
没有任何错误。我将其粘贴script.exe到与我的文件夹相同的文件夹中script.py,并在运行它之后在步骤中认为subprocess它没有应答,因为我print在子进程行及其工作之前。
有人知道为什么吗?
这是带有子流程的行:
import subprocess
from subprocess import Popen, PIPE
s = subprocess.Popen([EXE,files,'command'],shell=True, stdout=subprocess.PIPE)
Run Code Online (Sandbox Code Playgroud)
编辑:
同样的问题:
s = subprocess.check_output([EXE,files,'command'],shell=True, stderr=subprocess.STDOUT)
Run Code Online (Sandbox Code Playgroud) 在我的输入文件中,我有很多行,我现在只搜索一个,符合我的要求.这已经完成了.但是我需要在已经找到的这条线之后打印线.
输入示例:
line 1 x
line 2 a
line 3 a
line 3 a
Run Code Online (Sandbox Code Playgroud)
我正在寻找x里面的线.
for lines in input:
if 'x' in lines:
print (lines)
Run Code Online (Sandbox Code Playgroud)
reusult: line 1 x
所以现在我需要在结果后显示一行
预期结果:
line 1 x
line 2 a
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
for lines in input:
if 'x' in lines:
print (lines, '\n', lines[lines.index(lines) + 0:100])
Run Code Online (Sandbox Code Playgroud) 我正在寻找解决方案来显示字符串中两列之间差异的位置
Input:
df=pd.DataFrame({'A':['this is my favourite one','my dog is the best'],
'B':['now is my favourite one','my doggy is the worst']})
expected output:
[A-B],[B-A]
0:4 ,0:3 #'this','now'
3:6 ,3:8 #'dog','doggy'
14:18,16:21 #'best','worst'
Run Code Online (Sandbox Code Playgroud)
现在我只有一种方法来搜索差异(但不起作用,不知道为什么)
df['A-B']=df.apply(lambda x: x['A'].replace(x['B'], "").strip(),axis=1)
df['B-A']=df.apply(lambda x: x['B'].replace(x['A'], "").strip(),axis=1)
Run Code Online (Sandbox Code Playgroud)