Python Forum
How to rerun the program in a loop with different input?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to rerun the program in a loop with different input?
#3
This is untested code, but I think it's ok:
ips = "172.31.200.1,172.31.200.2"
ip_list = ips.split(',')
print(ip_list[0])
print(ip_list[1])
# or a better way:
for ip in ip_list:
    print(ip)
I had this sitting on my browser for about 14 minutes, didn't mean to step on Ichabod
Reply


Messages In This Thread
RE: How to rerun the program in a loop with different input? - by Larz60+ - Nov-20-2018, 05:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  problem program runs in a loop jasserin 0 190 May-18-2024, 03:07 PM
Last Post: jasserin
  WHILE LOOP NOT RETURNING USER INPUT AFTER ZerroDivisionError! HELP! ayodele_martins1 7 1,257 Oct-01-2023, 07:36 PM
Last Post: ayodele_martins1
  Code won't break While loop or go back to the input? MrKnd94 2 1,089 Oct-26-2022, 10:10 AM
Last Post: Larz60+
  Noob here. Random quiz program. Using a while loop function and alot of conditionals. monkeydesu 6 1,552 Sep-07-2022, 02:01 AM
Last Post: kaega2
  [Solved] Trying to rerun a snippet of code paracel 3 1,245 Jul-17-2022, 01:49 PM
Last Post: paracel
  WHILE Loop - constant variables NOT working with user input boundaries C0D3R 4 1,600 Apr-05-2022, 06:18 AM
Last Post: C0D3R
Exclamation question about input, while loop, then print jamie_01 5 2,812 Sep-30-2021, 12:46 PM
Last Post: Underscore
  I want to check if the input is str or is int & if it's str repeat the loop HLD202 4 2,890 Nov-23-2020, 11:01 PM
Last Post: perfringo
  Loop back through loop based on user input, keeping previous changes loop made? hbkpancakes 2 3,026 Nov-21-2020, 02:35 AM
Last Post: hbkpancakes
  Try-except in while loop: error with closing program Lupin_III 7 3,021 Jul-03-2020, 10:57 AM
Last Post: Lupin_III

Forum Jump:

User Panel Messages

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