Python3 Format print, to take bugs out of symbols

0
import os

with open('lista.txt', 'r') as lista:
    l = lista.read().splitlines()
    for s in l:
        v = os.system('ping '+s)
        print ((v).format)

This ping works, but returns with symbols like this: in letters that have an accent, I saw that the staff declare the variable and put .format, does not it have an easier way to not be putting .format at all ?? and put once the unicode utf-8 pro script all understand ??

I'm not sure how to do this,     

asked by anonymous 07.07.2018 / 22:02

1 answer

0

Put this command in the first line of your code and should work for everything to be utf-8:

-*- coding: utf-8 -*-

The IDE pycharm uses another similar command, but if you write it there it will ask you to fix it without problems, but in the others it should work very well.

Another way to fix in specific places is as follows:

variavel.decode('utf-8')

If it does not work, please report it.

    
08.07.2018 / 04:49