0

最初の行が true (6c00ff00 = 1) の場合、「y」である行 7 の出力を見つけるために、Python でスクリプトを作成する必要があります。これらすべての値をファイル (「xyz」など) にキャプチャすることはできますが、ファイル内で比較することはできません。

>>> vi xyz

6c00ff00 = 1
6c01ff00 = BGSV 1
6c02ff00 = 08IS01191025
6c03ff00 = 192.11.13.5
7005ff00 = g430
e808ff00 = 249
6c0aff00 = y
7002ff00 = 35 .4  .0  /
7001ff00 = 0
7b00ff00 =
7100ff00 = 1
7003ff00 = 192.11.13.150
4

1 に答える 1

0
with open('xyz') as infile:
  line1 = infile.readline().strip()
  for _ in xrange(6):
    line7 = infile.readline()
  line7 = line7.strip()
  print "The first line is '%s'" %line1
  print "The seventh line is '%s'" %line7
  if line1.split('=')[1].strip() == '1':
    if line7.split('=')[1].strip() == 'y':
      print "Correct"
    else:
      print "Wrong"
于 2013-10-16T05:37:17.080 に答える