Re: [Tutor] python3 - °F/°C printing those degree signs

2018-08-07 Thread Evuraan
> > You could try setting > > PYTHONIOENCODING="UTF-8" > > in your OS shell and see if that helps, but I suspect > there's a better way to deal with it... > Thank you! That was it! Exporting thusly made it behave: $ export PYTHONIOENCODING="UTF-8" $ python3 Python 3.5.2 (default, Nov 23 2017, 16

[Tutor] python3 - °F/°C printing those degree signs

2018-08-07 Thread Evuraan
Greetings! How to print °F/°C etc in python3? (This works on a WSL): ~$ python3 Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import platform >>> platform.release() '4.4.0-17134-Microsoft' >

[Tutor] threading for each line in a large file, and doing it right

2018-04-24 Thread Evuraan
Greetings! Please consider this situation : Each line in "massive_input.txt" need to be churned by the "time_intensive_stuff" function, so I am trying to background it. import threading def time_intensive_stuff(arg): # some code, some_conditional return (some_conditional) with open("massi

Re: [Tutor] subprocess.getstatusoutput : UnicodeDecodeError

2017-09-21 Thread Evuraan
> > getstatusoutput is a "legacy" function. It still exists for code that > has already been using it, but it is not recommended for new code. > > https://docs.python.org/3.5/library/subprocess.html#using-the-subprocess-module > > Since you're using Python 3.5, let's try using the brand new `run` >

Re: [Tutor] subprocess.getstatusoutput : UnicodeDecodeError

2017-09-21 Thread Evuraan
> > But: do you really want to "tail" what's probably not really a plaintext > file? Just guessing, but the .db as well as the error msgs are a hint. although the filename ends with a ".db", it is just a text file. not tailing a SQLite or a binary file, just happened to name it so. I work around

[Tutor] subprocess.getstatusoutput : UnicodeDecodeError

2017-09-21 Thread Evuraan
Greetings! My search-fu failed me, so thought of finally asking this question here. How can I work around this issue where subprocess.getstatusoutput gives up, on Python 3.5.2: >>> subprocess.getstatusoutput("tail -3 /tmp/pmaster.db",) Traceback (most recent call last): File "", line 1, in

[Tutor] @property vs @classmethod

2017-07-08 Thread Evuraan
Greetings! I was hoping to learn when to use classmethod and when to use property. They both seem similar (to me at least..), what's the pythonic way to choose between them? $ cat ./try.py #!/usr/bin/python3 class _someclass: _tag = "sometag" def __init__(self,_text): self._text

[Tutor] joining Indic and English Text

2017-06-25 Thread Evuraan
Greetings! I've a case where I need to put lines with both Indic and English Text to a file ( and optionally to stdout): # bash; ml_text="മലയാളം" en_text="Malayalam" echo "$ml_text = $en_text" >> /tmp/output.txt $ cat /tmp/output.txt മലയാളം = Malayalam That line above is what's I am trying to

[Tutor] __str__ on a subclass

2017-06-19 Thread Evuraan
Greetings! #!/usr/bin/python3 class Employee: """Class with FirstName, LastName, Salary""" def __init__(self, FirstName,LastName, Salary): self.FirstName = FirstName self.LastName = LastName self.Salary = Salary def __str__(s