1

My process1.txt is get from ps > process1.txt in windows powershell it is like this

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName                                                  
-------  ------    -----      -----     ------     --  -- -----------                                                                                                     
    167      12     2044       8024       0.02  14640   1 acrotray                                                     
    448      29    46584      33768       0.30  14692   1 acwebbrowser

I use ipython3 in win10

In [12]: f = open('process1.txt',encoding = 'unicode_escape')

In [13]: line = f.readlines()

I want to show the third line like

167      12     2044       8024       0.02  14640   1 acrotray    

but when I type in line[3] is show like this

In [15]: line[3]
Out[15]: '\x00\n'

and mysystem is utf-8 system how do I show the correct line ?

1 Answer 1

1

I used ConEmu and regenerated the file in the ConEmu console

tasklist > process3.txt

and get this

In [1]: f = open('process3.txt')

In [2]: line = f.readlines()

In [3]: line[3]
Out[3]: 'System Idle Process              0 Services                   0          8 K\n'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.