2017-06-23 12 views
-3
from sys import argv 

from os.path import exists 

print "Look what I can do" 

script,This_file,That_file,=argv 

print "I'm gonna paste this into that" 

Whatever=open(That_file) 

Whatevers = That_file.read() 

"So That_file is %d bytes long"%len(Whatever) 

"Do the input and output files exist?"% exists(This_file,That_file) 

Huh=open(That_file) 

Huh.write(Whatever) 

    AttributeError: 'str' object has no attribute 'read' 
+0

わかりました私はあなたのすべてがまだme.Iだけで作成しようとしていた役立つことを願ってquestion.Iの珍しい外観を言い訳してください、このサイトには比較的新しいですある.txtから別の.txtにコンテンツを貼り付けるプログラム。 – b1lal555

+0

文字列を読み取ることができません。ファイルを読み取ることができます。 'That_file'は文字列、' Whatever'はファイルです。 >> 'Whatever.read()' – Julien

+0

あなたの質問は何ですか?白線でエラーが発生しますか?なぜあなたのコードは二重に区切られますか?よりわかりやすい変数名を使用してください。 –

答えて

0

それはです:

Whatever=open(That_file) 
Whatevers = Whatever.read() 
+0

ありがとう、それは今作動する! – b1lal555

関連する問題