Python Forum
Python script Server list - if condition error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python script Server list - if condition error
#11
Sure, below are the details/algorithm. Please review and advise if I have make any changes to the code.

1. File /root/pydev/serv has server1, server2, server3
cat /root/pydev/serv
server1
server2
server3

2. Expected script function and output
- read the file /root/pydev/serv for its content.
- check the condition, which is "if the serv == server2"
- if the condition matches or equals the contents/line/server from the file then print only that server exclusively. (Example: serv ==server2 then print only "server2" as output.
- if the condition does not matches or equals (example: if condition serv == server5) then only print "No Serv found" in the output.
Reply


Messages In This Thread
RE: Python script Server list - if condition error - by razor04 - Jan-27-2020, 08:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  unable to remove all elements from list based on a condition sg_python 3 484 Jan-27-2024, 04:03 PM
Last Post: deanhystad
  Triggering a ps1 script in remote windows server via http python request jasveerjassi 1 402 Jan-26-2024, 07:02 PM
Last Post: deanhystad
  Python Alteryx QS-Passing pandas dataframe column inside SQL query where condition sanky1990 0 767 Dec-04-2023, 09:48 PM
Last Post: sanky1990
Sad "PriceSystem" Python Script error to Shopify API Alphetto 0 454 Jul-04-2023, 10:03 AM
Last Post: Alphetto
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,374 Jun-29-2023, 11:57 AM
Last Post: gologica
Question Need help for a python script to extract information from a list of files lephunghien 6 1,131 Jun-12-2023, 05:40 PM
Last Post: snippsat
  How to modify python script to append data on file using sql server 2019? ahmedbarbary 1 1,240 Aug-03-2022, 06:03 AM
Last Post: Pedroski55
  Server Folder Error : WinError5 Access Denied fioranosnake 1 1,152 Jun-21-2022, 11:11 PM
Last Post: Larz60+
  select Eof extension files based on text list of filenames with if condition RolanRoll 1 1,552 Apr-04-2022, 09:29 PM
Last Post: Larz60+
  No module named '_cffi_backend' error with executable not with python script stephanh 2 5,732 Nov-25-2021, 06:52 AM
Last Post: stephanh

Forum Jump:

User Panel Messages

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