File Name issue

MRAB python at mrabarnett.plus.com
Sat Oct 17 19:31:08 EDT 2020


On 2020-10-17 23:12, Steve wrote:
> The line:
> with open("HOURLYLOG.txt", 'r') as infile:
> works but, when I rename the file, the line:
> with open("HOURLY-LOG.txt", 'r') as infile:
> does not.  The complaint is: Cannot Assign to operator
> 
> However, I have:
> BPM_O2s=open("BPM-O2-Readings.txt","a")
> And it works.
> 
> At first, I thought the issue was due to having the - in the filename.
> 
> Is there a fix or explanation for this?
> Steve
> 
I see nothing wrong in those lines as written.

Try reducing it to the smallest complete example that shows the problem.


More information about the Python-list mailing list