خرید بک لینک

Vote count: 0

I have wrote code:

 with open('inputfile.txt') as f:
     #sending second line to variable port1
     port1 = (f.readlines()[1])
     # Make proper space 
     port1 = " ".join(port1.split())
     print port1
     # fetch eth0 to port1 variable
     port1 = port1.split(" ")[1]
     print port1

inputfile:

  server port1 port2
  server1  eth1    eth2
  server2  eth7    eth8

Above code working fine. I am getting expected results

But code not standard what i feels as i used port1 multiple times. Is there any good way to write this code?

asked 45 secs ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 26 فروردين 1396 ساعت: 13:38

صفحه بندی