On Fri, May 15, 2009 at 12:46 PM, Noufal Ibrahim <nou...@nibrahim.net.in> wrote: > MK wrote: >> >> Hi there, >> >> i am using this code to send an "cat > ThisIsMyUrl" with popen. >> Of cos cat now waits for the CTRL+D command. How can i send this command ? > > Wouldn't it be better if you directly opened the "ThisIsMyUrl" file and > wrote the text into it rather than rely on shelling out for this? > > [..] > > -- > ~noufal > http://nibrahim.net.in/
Agreed. Something like this perhaps? import sys def getFileFromUser(): f = open('ThisIsMyUrl', 'w') while True: s = sys.stdin.readline() if len(s) == 0: break # empty string denotes EOF f.write(s) f.close() Seems to work on my Mac. -- Walker Hale <walker.hale...@gmail.com> _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor