python-3.x

NoneType error' object is not iterable

There is code that implements key-values storage. import argparse import json import tempfile import os STORAGE_PATH = o ... ng for an incorrect key, it returns an error elif args.key: for i in get(args.key): print(i, end=" ")

How to install python 3.7 on Ubuntu 20.04 LTS

On Ubuntu 20.04 LTS, python 3.8 is pre-installed, but I need python 3.7. How do I install it and choose this particular python interpreter and how to install modules there.

Installing Pygame in PyPy

How do I install pygame in pypy? pypy3 -m pip install pygame - not working (running on Manjaro Linux) Here is the explanatio ... ------------ ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Datetime python3 how to output only the time?

Let's say I have a function def get_current_time() -> datetime: delta = datetime.timedelta(hours=3, minutes=0) ret ... e.now(datetime.timezone.utc) + delta How do I display only the time, or rather the hours and minutes? No date, seconds, etc.

Python. Is it possible to make a delay for the text output?

Tell me, is it possible to make a delay in the output of text on one line? Or is there some sort of bypass? If so, how do I do it? Sample text: print("Или... (возможная задержка) Это шутка, которую я не понимаю?")

Why does "1000000000000000 in range(1000000000000001)" work so fast?

As far as I understand, the range() function, which is actually a object type in Python 3, generates its contents on the fly, ... the question why is 1000000000000000 in range(1000000000000001) so fast in python 3 from the participant @RicksupportsMonica

Python. Is it possible to run a single thread many times?

I recently started studying threads in Python, specifically the threading module. And I need to make it so that after the en ... оторый нужно выполнить во время работы потока #событие: run = False How will this be implemented correctly? Python 3.8.3

Parallel execution of while loops in Python 3

I need to add game time that will go several times faster than normal time, doing this through a while loop. All loops should ... ime2)) if health <= 0: print("Конец игры. Ваше здоровье упало до нуля.") time.sleep(3) break

Analog of end = '\r' in input in python

In python, as you know, the print() command has end = '\r'. If it exists, the line will not start with a new line, but will c ... ll you right away-I tried to write this. But the code says that input has no end. Is there an end analog for input in python?

Tkinter window background image

How can I set the background image of the entire window in Tkinter? So that all the buttons are on top of

Problem with deleting a list item using the remove () method, in a python loop

l_o_v = [(years,yrs), (days,dys), (hours,hrs), (minutes,mnts), (seconds,sec)] #LIST OF VALUES for each in l_o_v: if ea ... cause the next condition is that the list length is used. I expect [(10, 'seconds')] instead of the received one the result.

Changing the Color Dialog PyQt5

In the vastness of stackoverflow, I found an example with color_dialog in PyQt5. I wanted to add it to my app, but I want to ... app = QtWidgets.QApplication(sys.argv) w = MainWindow() w.resize(640, 480) w.show() sys.exit(app.exec_())

Can I create my own REST queries?

There was a stupid question about the types of REST requests. I understand that these methods are generally accepted: POST-cr ... se a generally accepted method for some actions? (For example: Send DELETE, but create a new object instead of deleting it.)

How to parse a SECURE link?

I do parsing of one site. I want to output one link from there, but the output is not a link but class="url_protected", which ... 9maWxlcy9uLnByby9jZG" onclick="return false;"></a> If anything, here is a link to the site itself: ru.sefon.cc/news

Strange behavior of the str.rstrip() method in Python 3.7

Solving a problem from Yandex.The lyceum is faced with a curious problem. The fact is that when trying to trim the string "ni ... m. In this regard, the question:What is the reason for this behavior of the interpreter and how is this problem explained?

Python task: a list item that is larger than the previous one

Problem: a list with numbers is given. Write a program that outputs all the list items that are larger than the previous one ... [5] and should be [5, 5] because it should be output as a separate list Please tell me what needs to be changed in the code?

How to parse a website Dns-shop.ru?

I tried to do this: def parser(search): headers = {'x-requested-with': 'XMLHttpRequest', 'user-agent': 'M ... }); window.yaCounterReachGoal = function(e, p) { ym(7967056, 'reachGoal', e, p); } } catch(e) {} </script>

Finding the digits of a four-digit number

My source code is incorrect what is my mistake? Write a program to find the digits of a four-digit number. Input data format ... int('Цифра в позиции сотен равна', n2) print('Цифра в позиции десятков равна', n3) print('Цифра в позиции единиц равна', n4)

What is string.digits?

Please tell me what is the meaning of string.digits in general, and where in the code it can be used at all. It's just that i ... , but what string.digits does is not clear. It would be ideal to look at more code using string.digits. Thank you in advance.

How do I delete duplicates in an array with Python dictionaries?

It is necessary to remove duplicates by key value name from the array with dictionaries. I tried the following: def remove_du ... : 'invalid.url:8080'}, \ {'description': 'First service another description', 'name': 'service_one', 'value': 'invalid.url'}