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的包。
太谢谢了!
相关阅读
KPMG 二面应该怎么准备哦,特别是behavioral Question?请问各位有经验的朋友都是如何在不影响工作的前提下偷偷出去面试的?发现自己很没有finance敏感性![求购]Becker 2008 Course CD请问AICPA上的ethics的考试书很厚嘛?能否推荐一些自学access的材料?来说说自己是什么年龄段备考CPA知识点总结昨天考了BEC低价转让 2009 becker 资料有朋友愿意一起share Auditing的simulation吗?请问审计工作几月份最忙?几月份最闲?大家都是怎么复习AUD的?EA examoffer help求becker review pdf 和lectureCPA ethics(Wa state) 考完后可否在CV上写自己是CPA certificate holder?请推荐在哪挣够CPE Credits来维持CPA License?(全自费的情况下)今天考REG,被双重处罚了。FARE 大家lecture听了几遍,题做了几遍啊