擅长:python、mysql、java
<p>你的问题标题有点误导,因为一般用户不知道“wunderdata”是什么。你的问题也与此无关。你知道吗</p>
<p>从我对你的问题的理解来看,这就像把你的<code>raw_input</code>语句放在<code>for</code>循环之外一样简单:</p>
<pre><code># Create / open a file called wunderdata.txt which will be a CSVfile
f = open('wunderdata.txt', 'w')
# Enter necessary data
airport = str(raw_input("Enter airport code: "))
year = str(raw_input("Enter year: "))
# Iterate through months and day
for m in range(1, 13):
...
</code></pre>
<p>我相信<code>raw_input</code>已经返回了一个字符串,因此不需要进行转换,但是,由于我使用的是python3.x,所以我不能完全确定这一点</p>