On Wed, 12 Aug 2020 16:00:14 -0700 (PDT), in
gmane.comp.hardware.beagleboard.user TJF
<[email protected]> wrote:
>I forgot to mention that the modified file doesn't work in python2 any more:
>
>src/test$ python 1.py
>> File "1.py", line 32
>> print("%4X" % AdcV[i], end=" ") # output one channel in hex
>> ^
>> SyntaxError: invalid syntax
>>
>>
Without looking at the original source, I predict you were using
print "%4X" % AdcV[i] ,
where the trailing comma suppressed the automatic new-line of "print" and
just left a trailing space. Try replacing that line with
sys.stdout.write("%4X " % AdcV[i])
I've moved the space separator into the "..." format string.
.write() doesn't add line terminators, they are all up to the coder to
put in.
Personally -- I'd probably replace all the "print" calls with
equivalent sys.stdout.write() (inserting the proper line ending \n where
needed). For "deliverable" packages I tend to save "print" for
development/debug tracing information -- one can easily identify what is to
be removed when delivering the package.
--
Dennis L Bieber
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/6jgajf1aiseb5bc3e4h5ukmf5h367fl8ta%404ax.com.