modeString = "w"
fileNameString = "out.txt"
f = open(fileNameString, modeString)
f.write("This is a test for text output.")
f.close()


On Thu, Apr 14, 2016 at 4:06 PM, Melk933 <melkan...@gmail.com> wrote:

> The Python on my machine throws up an error.
> $ python testopen.py
> Traceback (most recent call last):
> File "testopen.py", line 1, in <module>     f= open("T3.txt", w)
> NameError: name 'w' is not defined
>
>
> On Wednesday, April 13, 2016 at 8:34:57 AM UTC-7, mickeyf wrote:
>>
>> I'm not a Python developer either, 'though I know it is very popular of
>> late. Does it say something about Python itself that it did not throw up a
>> big error in your face when the quotes were omitted? Or is the problem
>> elsewhere?
>>
>> On Wednesday, April 6, 2016 at 11:24:18 AM UTC-7, John Baker wrote:
>>>
>>> Gosh, how did I miss that, that the mode is a string. Well it had to be
>>> something simple like that. Quoting the w and r fixed the problem. Very
>>> embarrassing.
>>> :-[
>>> Thanks,
>>> John
>>>
>>>
>>>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to beagleboard+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to