python-3.6

import werkzeug VS from werkzeug import security

半城伤御伤魂 提交于 2019-12-24 13:27:41
问题 My current understanding (based on these answers: one, two, three; and Python documentation) of how import in Python works is (just in case it matters: all the code snippets are tested on Python 3.6.1) : Say we have a module mod , which has submodules sub and sub1 ; sub , in turn, has a function func ; then we can (given that mod installed in current environment, of course): import mod mod.sub.func() mod.sub1 # or import mod.sub mod.sub.func() mod.sub1 # will result in "NameError: name 'mod'

Using Selenium to find elements related to drop down list from another frame — Python

試著忘記壹切 提交于 2019-12-24 12:16:48
问题 I have been trying to write a program to automate my work. My task has series of steps but I am stuck at one point. I am constantly getting NoSuchElementException. I have tried to use id, class, name methods of Selenium but nothing seems to work. My present code is this: from selenium import webdriver from selenium.webdriver.common.by import By browser = webdriver.Chrome('C:\\Users\\abc\\AppData\\Local\\Programs\\Python\\Python36\\chromedriver.exe') browser.get("http://example.com/login.aspx"

Tensorflow 1.9 for CPU, without GPU still requires cudNN - Windows

大憨熊 提交于 2019-12-24 11:59:26
问题 I am working on a Win10 machine, with python 3.6.3 and using tensorflow 1.9, pip 18.0. I did not provide an option to install tensorflow with gpu, (i.e.), according to this link1, I used pip install tensorflow and did not provide option for using GPU. However, when trying to import tensorflow, I am faced with the following error ModuleNotFoundError: No module named '_pywrap_tensorflow_internal' After following various links, link2,link3, I installed the Visual studio update 3 and also used

What is the proper way to manage windows in pyqt5?

我们两清 提交于 2019-12-24 10:16:06
问题 In the application I am building I have a few "windows" I am working with. I am trying to figure out, according to python/industry standards, how to properly manage them. I have a warning screen, disclaimer screen, main gui, and essentially a message box for communicating errors. What my customer would like to transpire is the program displaying the warning screen (QDialog), and then the disclaimer screen (QDialog) on button click, then the main gui (QMainWindow) after the user has agreed to

Excluding undesired .dll import from PyQt5 while creating an executable with cx_freeze under Python 3.6

北城以北 提交于 2019-12-24 10:11:44
问题 I do have one question regarding PyQt5 and cx_freeze, and I hope you can help me. I would like to know if there is a way to exclude undesired .dll import from PyQt5 library while creating an executable with cx_freeze. This request comes from the fact that when I create my executable with cx_freeze the whole PyQt5 library is imported resulting in a quite heavy application (~220 Mb). In my cx_freeze setup.py I have coded the following: import sys from setuptools import setup, find_packages from

Multiprocessing Pipe send() blocks

岁酱吖の 提交于 2019-12-24 08:25:39
问题 According to Python documentation, only recv() blocks but not send() . I wrote the following code trying to make a GUI sudoku game. I made it in such a way that I can update the game board even if the tkinter is executing its mainloop . However, during a test run, I found that if I close the window while the game is updating, the pipe.send() starts to block (I found that out using CPython profiler.) Can anyone please tell me why and, if possible, how to fix this issue? To produce the issue:

Save text input to a variable in a kivy app

安稳与你 提交于 2019-12-24 08:23:22
问题 I am making a text based game, and there is a point at which the game asks the user to input their surname. I have worked out a way to save the name to a file, and load the name from the file, but I do not know how to save the text that has been input into a variable. I have tried various methods i have seen online, but none have worked for me so far. The section of my code in question currently looks like this: (ignore the odd names like customwidget, i was experimenting once and left them

Python 3 - function returns None type, yet print give correct output

浪子不回头ぞ 提交于 2019-12-24 07:50:24
问题 I wrote a function that takes a string and using a for loop reads each letter in the string. Based on what the two adjacent letters are, it writes a new letter to a new string. Once the for loop finishes, if the length of the new string is greater than 1, it calls the function again with the new string. Everything seems to work fine, except it is returning a None type. It will print the correct output from inside the function, and the type is correct (string), but when I do print(triangle(row

Convert tuple to list in a dictionary

隐身守侯 提交于 2019-12-24 07:05:55
问题 I have a dictionary like this: a= {1982: [(1,2,3,4)], 1542: [(4,5,6,7), (4,6,5,7)]} and I want to change the all the tuples (1,2,3,4),(4,5,6,7),(4,6,5,7) to lists, in this case: [1,2,3,4], [4,5,6,7], [4,6,5,7] I have tried for key, value in a.items(): for i in value: i = tuple(i) but it does now work. How can I achieve it? 回答1: As far as I understand you want to convert each tuple in a list. You can do this using a dictionary comprehension: {k: [list(ti) for ti in v] for k, v in a.items()}

Convert tuple to list in a dictionary

青春壹個敷衍的年華 提交于 2019-12-24 07:05:12
问题 I have a dictionary like this: a= {1982: [(1,2,3,4)], 1542: [(4,5,6,7), (4,6,5,7)]} and I want to change the all the tuples (1,2,3,4),(4,5,6,7),(4,6,5,7) to lists, in this case: [1,2,3,4], [4,5,6,7], [4,6,5,7] I have tried for key, value in a.items(): for i in value: i = tuple(i) but it does now work. How can I achieve it? 回答1: As far as I understand you want to convert each tuple in a list. You can do this using a dictionary comprehension: {k: [list(ti) for ti in v] for k, v in a.items()}