4 ms·
I'm fairly new to Python (within just a few years of my first use of it) but have already been hacking at some Py2 apps to update them to Py3 because, well, Uni
by spdustin 11y ago
I'm fairly new to Python (within just a few years of my first use of it) but have already been hacking at some Py2 apps to update them to Py3 because, well, Unicode. Much (not most, but much) of the random code I've tried to run with Py3 works without actual code modification beyond import statements.
Two primary exceptions: byte/string encoding in Py2, and print. So much of the Py2 syntax works without change in Py3, and while I wholeheartedly agree with "print('foo')" as the proper way to print something, "print 'foo'" is littered all over the random Py2 scripts I've found in my travels.
I am, in fact, converted to print(), for the record. The first time (in Py2) I tried to extrapolate what I learned about (asterisk)args, I attempted to do this:
print *df.columns
Whoops. Then came Py3:
print(*df.columns)
Huzzah! Instantly converted.
(edit again: Can't seem to get that asterisk to work without a full-on space)