python-3.7

Rename current file with variable value

僤鯓⒐⒋嵵緔 提交于 2019-12-13 03:10:01
问题 I am simply trying to get the value of column ' ID ' where two rows meet (meet where Name and Zip are on the same row) then with that row number, I get column ' ID ' value to rename file with. I don't think writing the ' .rename ' correctly for one.. any pointers appreciated. Currently no error, but no output either. import PyPDF2 from PyPDF2 import PdfFileWriter, PdfFileReader import re import config import xlrd import numpy as np import pandas as pd import math import os for filename in os

Python 3.7 install not working on openSUSE Leap 42.3

前提是你 提交于 2019-12-13 00:22:52
问题 When building and installing Python 3.7.0 from source on openSUSE Leap 42.3 there are serious python errors with the default ./configure which installs to /usr/local . (openSUSE Leap 42.3 Python3 package is only up to Python 3.4.6, and virtualenv does not yet have the release version 3.7.) $ python3 Python 3.7.0 (default, Jul 5 2018, 15:55:09) [GCC 4.8.5] on linux Type "help", "copyright", "credits" or "license" for more information. Traceback (most recent call last): File "/etc/pythonstart",

How to use dataclasses to generate a field value?

Deadly 提交于 2019-12-12 13:08:43
问题 I have the following class: class WordItem: def __init__(self, phrase: str, word_type: WORD_TYPE): self.id = f'{phrase}_{word_type.name.lower()}' self.phrase = phrase self.word_type = word_type @classmethod def from_payload(cls, payload: Dict[str, Any]) -> 'WordItem': return cls(**payload) How can I rewrite this class as a dataclass? Specifically, how should the id field be declared? It has a generated value, and is not a field that the code creating instances would provide. 回答1: Just move

How to get a discord bot to output everything user inputs instead of just the first input?

不想你离开。 提交于 2019-12-11 18:55:54
问题 I'm trying to get a bot that will repeat what a user inputs, as many times as the user specifies. The issue I'm running into is that if the user types: !repeat 5 x y , the bot will only repeat x 5 times, and not x y 5 times. This is the code I'm trying to run: @bot.command() async def repeat(times: int, content="Repeating..."): for i in range(times): if times > 10: await bot.say("Cannot spam more than 10 messages at a time.") return else: await bot.say(content) 回答1: You can use the keyword

Using the keyboard to move the character in a maze

拈花ヽ惹草 提交于 2019-12-11 17:30:15
问题 I have created a simple maze and I have no way to move the character to the objective. The maze is on a TKinter window so I don't know if that is stopping the code from running. I have tried using pynput, which has worked in a seperate program without a tkinter window running, so I dont get whats wrong at all. def level1(): x=1 startx = 1 objectivex = 10 y=1 starty=1 objectivey=10 val_in_row = [[0,1,2,3,4,5,6,7,8,9,10,11],[0,3,7,11],[0,1,5,7,8,9,11],[0,3,5,6,11],[0,2,4,7,9,10,11],[0,4,6,10,11

Update and On_Draw Pyglet in Thread

时光总嘲笑我的痴心妄想 提交于 2019-12-11 17:29:28
问题 I wanted to ask, is it possible to put the Update and On_Draw functions of a Pyglet class created by the user in a thread? Let me explain. I have the class of my app of Pyglet, in which I need some functions (always of the same class) that work simultaneously with the Update and On_Draw functions. Now, I've been looking around and the only things I've found is inserting the entire Pyglet app into a main thread, but doing so would give problems to the Pyglet itself. I just need to have those

cannot find python3.7 when runing spark using spark-submit?

馋奶兔 提交于 2019-12-11 17:16:09
问题 There is a problem that has bothered me for a few days. It occurs when I am running Spark application using spark-submit, it shows like this below: 09:14:36 Exception in thread "main" java.io.IOException: Cannot run program "python3.7": error=2, No such file or directory 09:14:36 at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) 09:14:36 at org.apache.spark.deploy.PythonRunner$.main(PythonRunner.scala:100) 09:14:36 at org.apache.spark.deploy.PythonRunner.main(PythonRunner.scala) 09

How to pass part-of-speech in WordNetLemmatizer?

自闭症网瘾萝莉.ら 提交于 2019-12-11 16:26:52
问题 I am preprocessing text data. However, I am facing issue with lemmatizing. Below is the sample text: 'An 18-year-old boy was referred to prosecutors Thursday for allegedly stealing about ¥15 million ($134,300) worth of cryptocurrency last year by hacking a digital currency storage website, police said.', 'The case is the first in Japan in which criminal charges have been pursued against a hacker over cryptocurrency losses, the police said.', '\n', 'The boy, from the city of Utsunomiya,

Cannot import 'PyPDF2' in Python 3.7

萝らか妹 提交于 2019-12-11 14:36:54
问题 I am wondering, why, for the life of me I cannot import and use PyPDF2 (PDF library) in Python 3.7. Firstly, my import fails at top of main.py (i.e. below) from PyPDF2 import PdfFileReader Then I have tried pip install PyPDF2 and variants pip2 install PyPDF3 etc etc. All lead to the below output: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify

ValueError: invalid literal for int() with base 10: '\x00\x00\

对着背影说爱祢 提交于 2019-12-11 14:15:53
问题 I have a list of lists roots_3 = [['4', '5', '10'], ['11', '12', '13'], ['0', '17', '26'], ['1', '10', '15'], ['4', '19', '26'], ['11', '14', '22'],.... ] and I want to turn all the values inside in integer so I wrote a loop for i in range(len(roots_3)): for j in range(len(roots_3[i])): roots_3[i][j]= np.int(roots_3[i][j]) and this is the error I get : ValueError: invalid literal for int() with base 10: '\x00\x00\x00... Note that roots_3 is obtained from several text files like this: for file