[Tutor] Hello World in Python without space

Dave Angel d at davea.name
Sat Jul 16 02:16:02 CEST 2011


On 07/15/2011 07:39 PM, Richard D. Moores wrote:
> On Fri, Jul 15, 2011 at 16:21, xDog Walker<thudfoo at gmail.com>  wrote:
>
>> I believe on Windows, you can almost always use a forward slash in a path:
>> C:/somewhere/somewhereelse/
> with open("C:/test/test.txt", "a") as file_object:
>       print("Hello, world!", file=file_object)
>
> Yes, that works for me with Windows Vista. However, if test.txt is
> empty, it puts in a blank line as line 1; line 2 is "Hello, world!".
>
> Dick
> _
I expect that your extra newline was already in the "empty" file.  It 
cannot have anything to do with using the forward slash for the filename.

DaveA



-- 

DaveA



More information about the Tutor mailing list