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的包。
太谢谢了!
相关阅读
求Becker CPA 2011 Regulation 考题和书的PDF有没有人会MS Access?帮我做个school project,付费救助怀孕6个月 穿什么去参加job fair更改考试时间本科想考cpa,怎么凑那20多的学分呢?4月24日 星期天 CA Bay Area 版聚 时间地点已定BEC final review 的PDFAudit Score Released in ME有没有同学做过沃尔玛暑期的leadership intern?Accounting for Governmental and Nonprofit Entities 这门课对考CPA 重要吗?汇报 Deloitte on campus interview-texas, 兼问大家的反馈学历情况复杂,请高人指点怎么完成cpa之路!报税问题请教Anyone knows how to solve this question from Becker's Review? Thanks!请问cancel CPA考试能否退钱?对一边上班一边复习的XDJM表示非常的佩服请教达人们考试全部通过后拿license的经验4月初考FAR的同学们成绩出了么?紧急求助----安永电面LA 地区.谁需要2011Becker software.