0

I received a suggestion that might help with Getting the amount of available lines in a terminal.

Here was the suggestion:

Is os.environ.get('ROWS') or os.environ.get('LINES') not cross-platform enough? Sure, it doesn't work on NT unless you're running cygwin or 4NT, or on most modern Mac or Linux setups, but it covers DOS, Win9x, and tons of old Unix terminals from before the days of tput or BSD-style stty. :)

I am familiar with the function os.environ.get()(from How do I access environment variables from Python?)

The problem is that I do not understand what environment variables LINES and ROWS refer to.

Is this a preexisting variable on some consoles, or would I need to always set them myself?

Here is what I tried in my console:

>>> import os
>>> print(os.environ.get('LINES'))
None
>>> print(os.environ.get('ROWS'))
None
>>> 

So it is clear in my Windows terminal at least they are not set.

I am also unsure what they do and even if they exist since I could not find anything about either of them.

Xantium
  • 11,201
  • 10
  • 62
  • 89

0 Answers0