This code in PyCharm is highlighted as an error, how to fix it?
lesson1.py :
$ telnet www.google.com 80 This code in PyCharm is highlighted as an error, how to fix it?
lesson1.py :
$ telnet www.google.com 80 You cannot write commands in Python code that you write on the command line.
To execute such commands in Python, you need to call them with a special method:
import subprocess result = subprocess.run(["telnet", "www.google.com", "80"], stdout=subprocess.PIPE) # на экране будет выведен результат работы команды # и информация об объекте result (экземпляр класса CompletedProcess) print(result, dir(result)) More details about running commands from Python code can be found in the official documentation for the subprocess module.
urlopen() , depending on your needs. - jfsSource: https://ru.stackoverflow.com/questions/595489/
All Articles