If you need an int isn't better to use input() instead of raw_input() ?<br><br><div class="gmail_quote">On Tue, Aug 23, 2011 at 10:00 PM, Adrián Monkas <span dir="ltr"><<a href="mailto:adrian.monkas@bqn.com.uy">adrian.monkas@bqn.com.uy</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi.<br>I`ve been trying to copy a long text from one file to another but it always copied me just a small part.<br>I would be glad if you can help me or explain which is my error.<br>
Thanks<br><br>----------------------------------------------------------------------------------<br>
def runMenu():<br><br> print "\nMENU"<br> print " 1) Copiar"<br> print " 0) Exit"<br><br> response = int( raw_input().strip() )<br><br> if response == 1:<br> print "Copiar" <br>
try:<br> print "Abro Archivo Origen"<br> archivo=open("D:\Boot.txt","r")<br> print "Name of the file: ", <a href="http://archivo.name" target="_blank">archivo.name</a><br>
print "Closed or not : ", archivo.closed<br> print "Opening mode : ", archivo.mode<br> <br> print "--------ORIGEN-----------"<br> print archivo.read()<br>
print "-------------------------"<br> archivo.seek(0, 0)<br><br> print "Abro Archivo Destino"<br> archivo2=open("D:\Copia.txt","w+")<br>
print "Name of the file: ", <a href="http://archivo2.name" target="_blank">archivo2.name</a><br> print "Closed or not : ", archivo2.closed<br> print "Opening mode : ", archivo2.mode<br>
<br><br><br> archivo2.write(archivo.read())<br><br> archivo2.seek(0, 0)<br> print "---------DESTINO---------"<br> print archivo2.read()<br> print "-------------------------"<br>
archivo.close()<br> archivo2.close()<br> <br> except IOError:<br> print ("I/O Error de Lectura")<br> else:<br> print "Lectura OK"<br>
<br> elif response == 0:<br> #device.close()<br> print "Exit"<br> <br> return response<br><br>def main():<br> print "main"<br> while(1):<br> if runMenu() == 0: break<br>
<br>main()<br><br><br>
<br>--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Muresan Alexandru<div>Web Developer</div><div>0740782921</div><br>