相关疑难解决方法(0)

为什么代码的"复制和粘贴"很危险?

有时,我的老板会向我们抱怨:

为什么我们需要这么长的时间来实现一个功能?

实际上,该功能之前已经在另一个应用程序中实现,您只需要从那里复制和粘贴代码.成本应该很低.

这真的是一个难题,因为在我看来,复制和粘贴代码并不是一件简单的事情.

你有什么理由向你的非技术老板解释这个吗?

copy-paste dry

129
推荐指数
8
解决办法
2万
查看次数

Total Python Noob:为什么这不起作用?

我正在研究学习Python的艰难之路,并试图理解它,而不仅仅是锤击.我在练习16上遇到了困难,正如在SO上所讨论的那样:

非常基本的Python问题(字符串,格式和转义)

但我仍然想弄清楚为什么这种方法不起作用:

from sys import argv

script, filename = argv


print "Attempting to open the file now." 
print open(filename).read()

print "We're going to erase %r." % filename
print "If you don't want that, hit CTRL-C."

print "If you do want that, hit RETURN." 

raw_input("?")

print "Opening the file..."
target = open(filename, 'w')

print "Truncating the file. Goodbye!"
target.truncate()

print "Now I'm going to ask you for three lines." 

line1 = raw_input("line 1: ")
line2 = raw_input("line 2: …
Run Code Online (Sandbox Code Playgroud)

python string line new-operator

0
推荐指数
2
解决办法
1179
查看次数

标签 统计

copy-paste ×1

dry ×1

line ×1

new-operator ×1

python ×1

string ×1