Python Forum
subprocess return of stdout after running Linux command
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
subprocess return of stdout after running Linux command
#2
b is bytes. You need to convert it to a string and then remove the newline with strip method
    print(p.decode().strip())
Recommended Tutorials:
Reply


Messages In This Thread
RE: subprocess return of stdout after running Linux command - by metulburr - Oct-13-2016, 04:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is possible to run the python command to call python script on linux? cuten222 6 924 Jan-30-2024, 09:05 PM
Last Post: DeaD_EyE
  [subprocess] Why stdout sent to stderr? Winfried 3 590 Jan-26-2024, 07:26 PM
Last Post: snippsat
  Using subprocess to execute complex command with many arguments medatib531 5 2,111 Apr-27-2023, 02:23 PM
Last Post: medatib531
  Running script with subprocess in another directory paul18fr 1 4,260 Jan-20-2023, 02:33 PM
Last Post: paul18fr
  Running 3rd party libs on Steam Deck (Arch Linux) with restricted access metulburr 0 1,972 Jan-07-2023, 10:41 PM
Last Post: metulburr
  Performance options for sys.stdout.writelines dgrunwal 11 3,314 Aug-23-2022, 10:32 PM
Last Post: Pedroski55
  How to use a variable in linux command in python code? ilknurg 2 1,672 Mar-14-2022, 07:21 AM
Last Post: ndc85430
  Controlling what get outputted to stdout when running external commands Daring_T 4 2,284 Jan-30-2022, 05:40 PM
Last Post: bowlofred
  use subprocess on linux\pi wwith a "grep " command korenron 2 8,393 Oct-19-2021, 10:52 AM
Last Post: DeaD_EyE
  Did subprocess.Popen() causes main routine to pause stdout? liudr 4 3,756 May-04-2021, 08:58 PM
Last Post: liudr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020