f*m
2 楼
以前签过。 今年又想回国,可以再去CJ签吗?
F*3
3 楼
问题很白,真是不好意思。
What I want to do is to read the input.txt file line by line and then put
into a function and write the output line by line to output.txt.
with open('/path/to/directory/input.txt','r') as f:
with open('/path/to/directory/output.txt','w') as g:
for x in f:
x = x.rstrip()
if not x: continue
print >> g, some_lib.some_function(x)
But sometimes the function won't be able to generate the output for x, and
report error. I tried to use exception handling in Python, but the program
loops over the first line instead of moving on to the next line.
with open('/path/to/directory/input.txt','r') as f:
with open('/path/to/directory/GeoIP/output.txt','w') as g:
for x in f:
x = x.rstrip()
if not x: continue
while True:
try:
print >> g, some_lib.some_function(x)
except ValueError:
print >> g, "cannot find value"
请问我哪里搞错了?不好意思我是文科的。。。
What I want to do is to read the input.txt file line by line and then put
into a function and write the output line by line to output.txt.
with open('/path/to/directory/input.txt','r') as f:
with open('/path/to/directory/output.txt','w') as g:
for x in f:
x = x.rstrip()
if not x: continue
print >> g, some_lib.some_function(x)
But sometimes the function won't be able to generate the output for x, and
report error. I tried to use exception handling in Python, but the program
loops over the first line instead of moving on to the next line.
with open('/path/to/directory/input.txt','r') as f:
with open('/path/to/directory/GeoIP/output.txt','w') as g:
for x in f:
x = x.rstrip()
if not x: continue
while True:
try:
print >> g, some_lib.some_function(x)
except ValueError:
print >> g, "cannot find value"
请问我哪里搞错了?不好意思我是文科的。。。
T*s
4 楼
题目见附件,没想明白这个166 deferred interest revenue是怎么回事,谢谢
M*0
5 楼
In general, all antihypertensive medications require prescription.
But there are lots of medications that only cost $4 for a month's supply
once you have prescriptions, much cheaper than those in China.
But there are lots of medications that only cost $4 for a month's supply
once you have prescriptions, much cheaper than those in China.
g*1
6 楼
顺便问一下楼主,在墨西哥签证的风险大不大?
w*k
7 楼
while true caused infinite loop
why do u need that line?
【在 F****3 的大作中提到】
: 问题很白,真是不好意思。
: What I want to do is to read the input.txt file line by line and then put
: into a function and write the output line by line to output.txt.
: with open('/path/to/directory/input.txt','r') as f:
: with open('/path/to/directory/output.txt','w') as g:
: for x in f:
: x = x.rstrip()
: if not x: continue
: print >> g, some_lib.some_function(x)
: But sometimes the function won't be able to generate the output for x, and
why do u need that line?
【在 F****3 的大作中提到】
: 问题很白,真是不好意思。
: What I want to do is to read the input.txt file line by line and then put
: into a function and write the output line by line to output.txt.
: with open('/path/to/directory/input.txt','r') as f:
: with open('/path/to/directory/output.txt','w') as g:
: for x in f:
: x = x.rstrip()
: if not x: continue
: print >> g, some_lib.some_function(x)
: But sometimes the function won't be able to generate the output for x, and
F*3
10 楼
太谢谢了!
我把while true干掉以后就可以了。
但是出现exception的时候好像程序直接跳过print >> g, "cannot find value",没有
写入错误信息怎么办?
with open('/path/to/directory/input.txt','r') as f:
with open('/path/to/directory/GeoIP/output.txt','w') as g:
for x in f:
x = x.rstrip()
if not x: continue
try:
print >> g, some_lib.some_function(x)
except ValueError:
print >> g, "cannot find value"
结果就是我有100个input,output文件只有50几个。。。,我希望output也有一百个,
只是有些是“cannot find value”
我把while true干掉以后就可以了。
但是出现exception的时候好像程序直接跳过print >> g, "cannot find value",没有
写入错误信息怎么办?
with open('/path/to/directory/input.txt','r') as f:
with open('/path/to/directory/GeoIP/output.txt','w') as g:
for x in f:
x = x.rstrip()
if not x: continue
try:
print >> g, some_lib.some_function(x)
except ValueError:
print >> g, "cannot find value"
结果就是我有100个input,output文件只有50几个。。。,我希望output也有一百个,
只是有些是“cannot find value”
i*r
12 楼
你确定exception 是 value error么?
【在 F****3 的大作中提到】
: 太谢谢了!
: 我把while true干掉以后就可以了。
: 但是出现exception的时候好像程序直接跳过print >> g, "cannot find value",没有
: 写入错误信息怎么办?
: with open('/path/to/directory/input.txt','r') as f:
: with open('/path/to/directory/GeoIP/output.txt','w') as g:
: for x in f:
: x = x.rstrip()
: if not x: continue
: try:
【在 F****3 的大作中提到】
: 太谢谢了!
: 我把while true干掉以后就可以了。
: 但是出现exception的时候好像程序直接跳过print >> g, "cannot find value",没有
: 写入错误信息怎么办?
: with open('/path/to/directory/input.txt','r') as f:
: with open('/path/to/directory/GeoIP/output.txt','w') as g:
: for x in f:
: x = x.rstrip()
: if not x: continue
: try:
F*3
13 楼
报错是这样的:
File "GeoIPcity.py", line 10, in
print >> g, gi.cityby_name(x)
File "build/bdist.linux-i686/egg/pygeoip/__init__.py", line 551, in org_by
_name
File "build/bdist.linux-i686/egg/pygeoip/__init__.py", line 412, in _
gethostbyname
socket.gaierror: [Errno -5] No address associated with hostname
这个是不是ValueError啊?其他的我不知道了。。。请问还有可能是什么种类的
exception我可以一个一个套。用的是geoip的包。
太谢谢了!
File "GeoIPcity.py", line 10, in
print >> g, gi.cityby_name(x)
File "build/bdist.linux-i686/egg/pygeoip/__init__.py", line 551, in org_by
_name
File "build/bdist.linux-i686/egg/pygeoip/__init__.py", line 412, in _
gethostbyname
socket.gaierror: [Errno -5] No address associated with hostname
这个是不是ValueError啊?其他的我不知道了。。。请问还有可能是什么种类的
exception我可以一个一个套。用的是geoip的包。
太谢谢了!
相关阅读
请教LLC的报税问题裸考AUD报告有兴趣合作成立CPA Firm的吗?REG过了,发包子庆祝校园招聘会都应该问什么?anybody is familiar with Caterpillar recruiting process?谁有(AUD)becker final Review and simulation我买在线等,多谢!求2011 wiley test bank 2011参加KPMG 面试的同学们帮帮忙四门全过,感谢本版,分享速成备考经验有沒有人知道Ethic exam有沒有期限哩?!询问下会计工资情况小声问下在四大工作的姐妹,你们有空闲的时间还自己学习吗?纽约州报名CPA问题请教Gift Fund向CPA请教公司交税的问题请教四大一般Senior level的审计人员给配手机么?通过REG的同学来介绍下复习经验吧明晚上 e&y的请我们好几个同学去吃饭,应该注意点什么.四大工作机会