Skip to main content

Posts

PyCharm vs IDLE: oddities

First learning: be explicit in PyCharm. I was using the following to work with reading a file using readlines() sonnetFile = open ( '/home/csaunderson/learning/sonnet29.txt' ) sonnetFile.readlines() which returned correctly in IDLE: >>> sonnetFile = open('/home/csaunderson/learning/sonnet29.txt') >>> sonnetFile.readlines() ["When, in disgrace with fortune and men's eyes,\n", 'I all alone beweep my outcast state,\n', 'And trouble deaf heaven with my bootless cries,\n', 'And look upon myself and curse my fate,\n'] But in PyCharm, it returned simply a return code zero, which is success, but failure. Instead, I had to explicitly print() the output: sonnetFile = open ( '/home/csaunderson/learning/sonnet29.txt' ) print (sonnetFile.readlines()) Which then gave me: /home/csaunderson/PycharmProjects/learning/venv/bin/python /home/csaunderson/learning/first_readlines.py ["When, in disgrace with ...
Recent posts

Python 2 vs Python 3

I'm going to start learning in Python3, but with an eye to keeping things compatible with Python 2.7. I'm not sure how well that'll work, but it'll be necessary in order to be able to work with the HPSA pytwist APIs