teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

コード部分の書式の修正

2016/08/07 06:22

投稿

UMA00
UMA00

スコア18

title CHANGED
File without changes
body CHANGED
@@ -6,6 +6,7 @@
6
6
  ※.find("指定した文字列")で、行頭から何文字目かは分かった。
7
7
 
8
8
  ###インプットのXMLファイル
9
+ ```Python
9
10
  <?xml version="1.0"?>
10
11
  <data>
11
12
  <country name="Liechtenstein">
@@ -29,9 +30,10 @@
29
30
  <neighbor name="Colombia" direction="E"/>
30
31
  </country>
31
32
  </data>
32
-
33
+ ```
33
- ###編集ファイル(Python)
34
+ ###編集ファイル
35
+ ```Python
34
- ```# -*- coding: utf-8 -*-
36
+ # -*- coding: utf-8 -*-
35
37
  f = open('country_data.xml', 'r')# inputファイル'country_data.xml'を読み込み、変数textに代入
36
38
  text = f.read()
37
39
  f.close
@@ -42,6 +44,7 @@
42
44
  if rank.text == '1':
43
45
  print text.find(rank.text) # =>15
44
46
  print inspect.currentframe().f_lineno # =>11
47
+ ```
45
48
 
46
49
  ###試したこと
47
50
  上記のように、