Python Forum
Os command output in variable shows wrong value
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Os command output in variable shows wrong value
#2
I found a solution!

v_num_distinct_phy_disks_in_cells = subprocess.check_output("cat /tmp/p_count_num_phy_disks_all_cell | sort -u | wc -l", shell=True);
print (v_num_distinct_phy_disks_in_cells)
Reply


Messages In This Thread
RE: Os command output in variable shows wrong value - by paulo79 - Apr-09-2022, 03:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Compiles Python code with no error but giving out no output - what's wrong with it? pythonflea 6 1,739 Mar-27-2023, 07:38 AM
Last Post: buran
  Python Pandas Syntax problem? Wrong Output, any ideas? Gbuoy 2 1,010 Jan-18-2023, 10:02 PM
Last Post: snippsat
  Python VS Code: using print command twice but not getting output from terminal kdx264 4 1,223 Jan-16-2023, 07:38 PM
Last Post: Skaperen
  Am I wrong or is Udemy wrong? String Slicing! Mavoz 3 2,822 Nov-05-2022, 11:33 AM
Last Post: Mavoz
  How to combine two output in one variable? ilknurg 2 1,303 Aug-01-2022, 09:31 AM
Last Post: Gribouillis
  How to write a part of powershell command as a variable? ilknurg 2 1,198 Jul-26-2022, 11:31 AM
Last Post: ilknurg
  ModuleNotFound but pip shows module installed biscotty666 2 1,652 Jul-14-2022, 05:17 PM
Last Post: Axel_Erfurt
  How to use a variable in linux command in python code? ilknurg 2 1,678 Mar-14-2022, 07:21 AM
Last Post: ndc85430
  Command output to Variable ironclaw 1 1,847 Aug-26-2021, 06:55 PM
Last Post: bowlofred
  For loops returning wrong output Nighthound21 1 2,023 May-03-2021, 03:43 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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